LoadRawMessage Method

Load email from a *.EML file to raw_Content property and send it with 100% original format.

Visual C++: HRESULT LoadRawMessage(BSTR FileName, LONG Flag, long* pVal)
Visual Basic: LoadRawMessage(FileName As String, LONG Flag) As Long


The full path of the email file to load.
If this value is zero, this method only loads the email content; If this value is 1, this method also parses From, Reply-to, Recipients and load it to current mail object.

Return Value

If this method succeeds, the return value is zero; otherwise the return value is non-zero.


This method is different with LoadMessage method, with LoadMessage method, you can edit subject, body text, from, recipient later. However, with this method, you can only specify the From and Recipients, EASendMail does not change the original email content, just uses new sender and recipient to forward the content to specified SMTP server.


[VB6, VBA - Forward EML File]    

Const ConnectNormal = 0
Const ConnectSSLAuto = 1
Const ConnectSTARTTLS = 2
Const ConnectDirectSSL = 3
Const ConnectTryTLS = 4

Dim oSmtp As EASendMailObjLib.Mail
Set oSmtp = New EASendMailObjLib.Mail
' for evaluation usage, please use "TryIt" as the license code.
oSmtp.LicenseCode = "TryIt"

' Your SMTP server address
oSmtp.ServerAddr = "smtp.emailarchitect.net"

' User and password for ESMTP authentication
oSmtp.UserName = "test@emailarchitect.net"
oSmtp.Password = "testpassword"

' ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically
oSmtp.ConnectType = ConnectTryTLS

' load this email from file.
oSmtp.LoadRawMessage "c:\my folder\test.eml", 1

' send the email with 100% original format.
If oSmtp.SendMail() = 0 Then
    MsgBox "Message delivered!"
    MsgBox oSmtp.GetLastErrDescription()
End If

oSmtp.raw_Content = ""

See Also

raw_Content Property
LoadMessage Method
ImportMailEx Method