SaveMailEx Method

Save current email to IIS SMTP Service pickup path.

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

Parameter:

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.


Remarks

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("EASendMailObj.Mail")
oSmtp.LicenseCode = "TryIt"
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"
  Response.Write oSmtp.GetLastErrDescription()
End If

See Also

SendMail Method