SaveMailEx Method

Save current email to IIS SMTP Service pickup path for delivery.

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


IIS SMTP Service pickup path. All emails saved in this directory would be queued and sent by IIS SMTP Service in background.

Return Value

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"
We strongly recommend you use EASendMail Service to send bulk emails instead of IIS SMTP service. To learn more detail, please have a look at: Work with EASendMail Service(Mail Queuing).


[ASP, VBScript - Send Email by IIS SMTP Pickup]  
Dim oSmtp, pickupPath
Set oSmtp = Server.CreateObject("EASendMailObj.Mail")
oSmtp.LicenseCode = "TryIt"
pickupPath = "c:\inetpub\mailroot\pickup"

oSmtp.FromAddr = ""
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"
  Response.Write "SaveMailEx method failed"
  Response.Write oSmtp.GetLastErrDescription()
End If

See Also

Work with EASendMail Service(Mail Queuing)
SendMailToQueue Method
SendMailToQueueEx Method
SendMail Method