0

サーバー: Windows 2003 r3

プログラムは、フォルダーに表示されると自動的に電子メールを送信することになっています。

私が抱えている問題は、作成中のオブジェクトのサポートが見つからないことです。

text/html content-type を使用して電子メールを送信しようとしていますが、送信された電子メールは 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

ご意見ありがとうございます。

4

0 に答える 0