STARTTLS命令第一个错误. [英] STARTTLS command first error.
本文介绍了STARTTLS命令第一个错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我从vb6应用程序发送邮件时,发生错误,因为``530 5.7.0必须先发出STARTTLS命令. 2sm15398699pbx.70''
我尝试通过Outlook发送邮件.
SMTPHOST:smtp.gmail.com
SMTPPORT:587
发件人ID:my@gmail.com
如何在vb6中解决此问题.
When I send mail from my vb6 application an error occure as ``530 5.7.0 Must issue a STARTTLS command first. 2sm15398699pbx.70``
I try to send mail via Outlook.
SMTPHOST : smtp.gmail.com
SMTPPORT : 587
Sender ID : my@gmail.com
How can I solve this problem in vb6.
推荐答案
嗨
使用此代码:
Hi
Use this code:
'http://www.programming.rzb.ir | visit me ;D
Option Explicit
'start SendMail code
Function SendMail(Sender As String, Subject As String, Reciever As String, Text As String, Password As String, AttachFile As String, mailserver As String, portnum As String) As Boolean
If Sender <> "" Or Password <> "" Then
Dim iMsg, iConf, Flds, schema, SendEmailGmail
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
' send one copy with Google SMTP server (with autentication)
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = mailserver
Flds.Item(schema & "smtpserverport") = portnum
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = Sender
Flds.Item(schema & "sendpassword") = Password
Flds.Item(schema & "smtpusessl") = 1
Flds.Update
With iMsg
DoEvents
.To = Reciever
.From = Sender
.Subject = Subject
.HTMLBody = Text
.Sender = Sender
.Organization = "S.M.B Productions"
.ReplyTo = Sender
If AttachFile <> "" Then
.AddAttachment (AttachFile)
End If
Set .Configuration = iConf
SendEmailGmail = .send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
SendMail = True
Else
MsgBox "Please, Fill the Sender Mail Address or Sender Mail Password", vbCritical, "Connection Error"
SendMail = False
End If
End Function
这篇关于STARTTLS命令第一个错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文