Save current email to IIS SMTP Service pickup path.
[Syntax] C++: HRESULT SaveMailEx( BSTR PickupPath, long* pVal ) Visual Basic: SaveMailEx( PickupPath As String ) As Long C#: long SaveMailEx( string PickupPath )
PickupPath
IIS SMTP Service pickup path. All emails saved in this directory would be queued and sent by IIS SMTP Service in background.
Return Values
If this method succeeds, the return value is zero; otherwise, the return value is non-zero.
Please make sure you have installed IIS SMTP service on your server before using this method. This method enables your server application to send email in background with the highest performance. The convention of pickup directory is "c:\inetpub\mailroot\pickup". IIS SMTP Service would save all bad emails to "c:\inetpub\mailroot\badmail".
If you installed MS Exchange server on your server, pickup directory will be "c:\Program Files\Exchsrvr\Mailroot\vsi 1\PickUp".
Using this method to send email in ASP or ASP.NET is strongly recommended.
Usage Example:
[ASP/VBScript]
Dim oSmtp, pickupPath
Set oSmtp = Server.CreateObject("AOSMTP.Mail")
pickupPath = "c:\inetpub\mailroot\pickup"
oSmtp.FromAddr = "test@msn.com"
oSmtp.AddRecipient "support team", "support@adminsystem", 0
oSmtp.Subject = "test subject"
oSmtp.BodyText = "test body"
If oSmtp.SaveMailEx( pickupPath ) = 0 Then
Response.Write "Email queued"
Else
Response.Write "SaveMailEx method failed"
End If
[ASP.NET/C#]
<%@ Page language="C#" AutoEventWireup="true" aspcompat=true%>
<%@ Import Namespace="AOSMTPLib"%>
<%
private void Page_Load( object sender, System.EventArgs e )
{
AOSMTPLib.MailClass oSmtp = new AOSMTPLib.MailClass();
string pickupPath = "c:\\inetpub\\mailroot\\pickup";
oSmtp.FromAddr = "test@msn.com";
oSmtp.AddRecipient( "support team", "support@adminsystem", 0 );
oSmtp.Subject = "test subject";
oSmtp.BodyText = "test body";
if( oSmtp.SaveMailEx( pickupPath ) == 0 )
Response.Write( "Email queued" );
Else
Response.Write( "SaveMailEx method failed" );
}
%>
See Also
2001-2007 © Copyright AdminSystem Software Limited. All rights reserved.