SaveMail Method

Save current email to specified email file.

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


The full path of the email file to be saved.

Return Value

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


If specified file name exists, this method will overwrite the existing file. You can use LoadMessage method to load the saved EML file back to Mail object.


[VB6, VBA - Save Email as File] 
Private Sub SaveEmail()
  Dim oSmtp As New EASendMailObjLib.Mail
  oSmtp.LicenseCode = "TryIt"
  oSmtp.Subject = "test"
  oSmtp.BodyText = "this is body"

  If oSmtp.SaveMail("c:\test.eml") = 0 Then
    MsgBox "Email saved!"
    MsgBox "Save email failed!"
    MsgBox oSmtp.GetLastErrDescription()
  End If
End Sub

See Also

LoadMessage Method
SendMail Method