SaveMail Method

Save current email to specified email file.

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

Parameter:

strFile

File name of the saved file.

Return Values

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.

Usage Example:

[Visual Basic]

Private Sub SaveEmail()
  Dim oSmtp As New AOSMTPLib.Mail
  oSmtp.Subject = "test"
  oSmtp.BodyText = "this is body"
  If oSmtp.SaveMail( "c:\test.eml" ) = 0 Then
    MsgBox "Email saved!"
  Else
    MsgBox "Save email failed!"
  End If
End Sub
[C#]
private void SaveEmail()
{
  AOSMTPLib.MailClass oSmtp = new AOSMTPLib.MailClass();
  oSmtp.Subject = "test subject";
  oSmtp.BodyText = "this is body";
  if( oSmtp.SaveMail( "c:\\test.eml" ) == 0 )
    Console.WriteLine( "Email saved!" );
  Else
    Console.WriteLine( "Save email failed" );
}

See Also

SendMail Method


2001-2007 © Copyright AdminSystem Software Limited. All rights reserved.