SendToQueueEx Method
Submits the message to IIS SMTP pickup folder
or to MailBee
Message Queue (MMQ) system for delivery.
In addition to standard "send-to-queue" functionality, it allows sending
messages from fake addresses (From header is ignored) to addresses different
from those specified in To/CC/BCC headers.
Sending from fake address commonly used in group mailings to make sure bounce
mails are all arrive to the same address.
MMQ is a message queuing system which intercepts mail transmissions from the
SMTP object and sends them in the background. This allows the SMTP
object to operate very quickly.
IIS SMTP server is also capable of bypassing SMTP protocol and picking messages
directly from the file system. Both MMQ and IIS SMTP use the same queue file
format and thus it's possible to use this method to submit into any of these
queues.
Another reason to use submitting to the pickup folder (especially in the case
of IIS SMTP queue) is security. Often, firewalls do not allow applications to
send mail via SMTP. In this case, the only way is to submit messages into the
pickup folder of IIS SMTP queue.
Unlike Send/SendEx methods, SendToQueueEx
method does not require established connection to SMTP server. Actual connection
and data transfer is made by MMQ system. However, LicenseKey property
must be still specified.
Note: this method produces files in .EML
format. To use it with MMQ, MMQ version must be 1.4 or above.
| blnResult = ObjectName.SendToQueueEx(DirPath, [FromAddr], [Recips]) | ||
| Parameters: | ||
| DirPath As String | Path to the directory used by IIS SMTP (usually, C:\Inetpub\mailroot\pickup) or by MMQ as a storage of message files (QueueDirPath parameter in mmq.ini file) | |
| FromAddr As String | (optional) If specified, overrides SMTP.Message.FromAddr setting. This may be used if you want to send email from address different from those specified in From header (sending from fake address) | |
| Recips As String | (optional) If specified, overrides SMTP.Message.ToAddr/CCAddr/BCCAddr setting. This may be used if you want to send email to addresses different from those specified in To/CC/BCC headers | |
| Return value As Boolean | True if successful, False otherwise (invalid license key, queue dir doesn't exist, i/o error, etc.) | |
Usage example:
Dim Mailer 'Using visual basic to create object Set Mailer = CreateObject("MailBee.SMTP") 'Using ASP to create object 'Set Mailer = Server.CreateObject("MailBee.SMTP") 'In ASP use Response.Write instead of MsgBox Mailer.LicenseKey = "put your license key here" Mailer.Message.ToAddr = "bill@yoursite.com" Mailer.Message.FromAddr = "joe@mysite.com" Mailer.Message.Subject = "Hello" Mailer.Message.ImportBodyText "C:\docs\letter.htm", True if Not Mailer.SendToQueueEx("C:\Inetpub\mailroot\pickup", "realsender@server.com") Then MsgBox Mailer.ErrDesc
See Also:
"Creating
and sending HTML-formatted messages" Tutorial
Connect Method
Send Method
LicenseKey Property
Copyright 2002-2008, AfterLogic Corporation. All rights reserved.