Email Windows Server 2003+;VB6+;SMTP;html内容类型不工作

Email Windows Server 2003+;VB6+;SMTP;html内容类型不工作,email,vb6,smtp,windows-server-2003-r2,Email,Vb6,Smtp,Windows Server 2003 R2,服务器:Windows2003R3 当电子邮件出现在文件夹中时,该程序应该会自动发送电子邮件 我遇到的问题是,我找不到对正在创建的对象的任何支持 我尝试使用text/html内容类型发送电子邮件,发送的电子邮件一直以text/plain接收,html通常显示为文本 正在创建的对象是: oMail As SMTP 我试过了 oMail.IsBodyHtml = True 及 我看到的所有在线教程都使用 Dim oSmtp As EASendMailObjLib.Mail 下面是整个函数 Pu

服务器:Windows2003R3

当电子邮件出现在文件夹中时,该程序应该会自动发送电子邮件

我遇到的问题是,我找不到对正在创建的对象的任何支持

我尝试使用text/html内容类型发送电子邮件,发送的电子邮件一直以text/plain接收,html通常显示为文本

正在创建的对象是:

oMail As SMTP
我试过了

oMail.IsBodyHtml = True

我看到的所有在线教程都使用

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
Public函数sEnd(oMail作为SMTP,MailToSend()作为OutMail,ByVal i作为整数)作为布尔值
错误转到发送电子邮件\u错误
模糊结果
'重置Smtp错误代码
iSmtpErr=0
'浏览要发送的邮件列表
带MailToSend(i)
如果.Status=EMO\u发送,则
多芬特
''''''''''''''''''''''''''''''''''''''
'加载Winsock
oMail.winsockloadded=True
'指定域、主机和邮件端口
oMail.MailServer=sOutboundDomain
oMail.MailPort=iOutboundMailPort
多芬特
'oMail.Action=a_ConnectToServer
oMail.Action=a\u
'oMail.IsBodyHtml=True
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'指定邮件内容:发件人、收件人、主题、正文。。
oMail.From=.SenderEmailAddr
oMail.To=.RecipientEmailAddr
oMail.SUBJECT=.SUBJECT
oMail.Date=格式(现在是“ddd,dd-mmm-yyyy hh:mm:ss”)&空格(1)和sTimeZone
oMail.MessageText=.Body
'oMail.MessageFormat=1
oMail.OtherHeaders=X_MAILER&Space(1)&sXMailer
"发信息",
oMail.Action=发送消息
.Status=EMO\u已发送
.TimeSent=现在
多芬特
“退出
oMail.Action=a_断开与服务器的连接
如果结束
以
发送=真
退出功能
发送电子邮件\u错误:
出错时继续下一步

如果iSmtpErr>=25005且iSmtpErr
oMail.MessageText
?是否有
oMail.Body
oMail.BodyText
?没有,此代码中唯一的正文是
oMail.MessageText
。我很好奇是否有人知道对象成功创建了吗?如果是这样(意味着它在您的项目中被引用),您不能使用对象浏览器来探索SMTP类的属性和方法吗?
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