服务器:Windows 2003 r3
当电子邮件出现在文件夹中时,程序应该自动发送电子邮件。
我遇到的问题是我找不到对正在创建的对象的任何支持。
我正在尝试使用 text/html 内容类型发送电子邮件,并且正在发送的电子邮件继续与 text/plain 一起接收,并且 html 通常显示为文本
正在创建的对象是:
oMail As SMTP
我试过了
oMail.IsBodyHtml = True
和
oMail.MessageFormat = 1
我见过的所有在线教程都在使用
Dim oSmtp As EASendMailObjLib.Mail
下面是整个函数
Public Function sEnd(oMail As SMTP, MailToSend() As OutMail, ByVal i As Integer) As Boolean
On Error GoTo SendEmail_Err
Dim result
' Reset Smtp err code
iSmtpErr = 0
' Go thru the list of Mail to send
With MailToSend(i)
If .Status = EMO_TO_SEND Then
DoEvents
''''''''''''''''''''''''''''''''''''''
' Load Winsock
oMail.WinsockLoaded = True
' Specify Domain, Host and Mail Port
oMail.MailServer = sOutboundDomain
oMail.MailPort = iOutboundMailPort
DoEvents
'oMail.Action = a_ConnectToServer
oMail.Action = a_ResetHeaders
' oMail.IsBodyHtml = True
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Specify Mail contents: Sender, Recipient, subject, body, ..
oMail.From = .SenderEmailAddr
oMail.To = .RecipientEmailAddr
oMail.SUBJECT = .SUBJECT
oMail.Date = Format(Now, "ddd, dd mmm yyyy hh:mm:ss") & Space(1) & sTimeZone
oMail.MessageText = .Body
' oMail.MessageFormat = 1
oMail.OtherHeaders = X_MAILER & Space(1) & sXMailer
' Send Message
oMail.Action = a_SendMessage
.Status = EMO_SENT
.TimeSent = Now
DoEvents
' Quit
oMail.Action = a_DisconnectFromServer
End If
End With
sEnd = True
Exit Function
SendEmail_Err:
On Error Resume Next
If iSmtpErr >= 25005 And iSmtpErr <= 26005 Or _
iSmtpErr = 20302 Or iSmtpErr = 20163 Or _
iSmtpErr = 20162 Then
' Changed to handle invalid email address error - July 20, 1999
' Or iSmtpErr = 0 Then
' Winsock/connection error
MailToSend(i).Status = EMO_NO_CONNECTION
RaiseAlert USER_CONNECTION_ERR, ""
Else
MailToSend(i).Status = EMO_FAILED_TO_SEND
End If
' Log error
Call LogError(CLng(iSmtpErr), MailToSend(i).FileName & ":" & Error, "Send")
' Put in to handle invalid email address error - July 20, 1999
oMail.Action = a_DisconnectFromServer
oMail.Action = a_Idle
sEnd = True
Exit Function
End Function
非常感谢您的任何意见!