如何使用SMTP服务器在vb6中发送电子邮件

时间:2017-12-19 11:21:19

标签: email vb6 smtp

如何使用SMTP服务器向vb6发送电子邮件,我尝试了以下代码     但我收到这样的错误     运行时错误' -2147220973(80040213)':传输无法连接      服务器。

Dim x 
Public Msg 
Public IMsg As New CDO.Message Public IConf As New CDO.Configuration  
Private Sub Command1_Click() 
x = "http://schemas.microsoft.com/cdo/configuration/" 
'lstResults.DataSource = GetMenuItems 

IConf.Fields.Item(x & "sendusing") = 2 
IConf.Fields.Item(x & "smtpserver") = "smtp.gmail.com" 
IConf.Fields.Item(x & "smtpserverport") = 465 
IConf.Fields.Item(x & "smtpauthenticate") = 1 
IConf.Fields.Item(x & "sendusername") = "parmalattest2017@gmail.com" 
IConf.Fields.Item(x & "sendpassword") = "Admin@123456" 
IConf.Fields.Item(x & "smtppusess1") = 1 
IConf.Fields.Update IMsg.To = "mohanraj.p@twilightsoftwares.com" 

IMsg.From = "parmalattest2017@gmail.com" 
IMsg.Subject = "Q & Q Statements" 
IMsg.Sender = "parmalattest2017@gmail.com" Set 
IMsg.Configuration = IConf 
IMsg.Send 

Exit Sub 

0 个答案:

没有答案