SaveMail Method


Save current email to specified email file.

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

Parameters

FileName
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.

Remarks

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.

Example

[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!"
  Else
    MsgBox "Save email failed!"
    MsgBox oSmtp.GetLastErrDescription()
  End If
End Sub

See Also

LoadMessage Method
SendMail Method