Attach all files in specified directory to current email.
[Syntax] C++: HRESULT AddAttachments( BSTR sPath, long* pVal ) Visual Basic: AddAttachments( sPath As String ) As Long C#: long AddAttachments( string sPath )
sPath
Directory path in which all files are to be attached to current email.
Return Values
This method returns the total count of files attached.
Usage Example:
[C#]
private void SendEmail()
{
AOSMTPLib.MailClass oSmtp = new AOSMTPLib.MailClass();
oSmtp.ServerAddr = "mail.adminsystem.net";
oSmtp.FromAddr = "test@adminsystem.net";
oSmtp.AddRecipient( "Support Team", "support@adminsystem.net", 0 );
oSmtp.BodyText = "Hello, this is a test....";
//all files in this directory would be attached to current email.
oSmtp.AddAttachments( "c:\\pictures" );
if( oSmtp.SendMail() == 0 )
Console.WriteLine( "Message delivered!" );
else
Console.WriteLine( oSmtp.GetLastErrDescription());
}
See Also
2001-2007 © Copyright AdminSystem Software Limited. All rights reserved.