SendToQueue Method


Submits the message to IIS SMTP queue (pickup folder) or to MailBee Message Queue (MMQ) system for delivery.

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.

To send from fake address, use SendToQueueEx method. Sending from fake address commonly used in group mailings to make sure bounce mails are all arrive to the same address.

Unlike Send method, SendToQueue method does not require established connection to SMTP server. Actual connection and data transfer is made by MMQ (or IIS SMTP) 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.SendToQueue(DirPath)  
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)  
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.SendToQueue("C:\MMQ Files") Then MsgBox Mailer.ErrDesc

See Also:

"Creating and sending HTML-formatted messages" Tutorial

LicenseKey Property

SendToQueueEx Method


Copyright 2002-2008, AfterLogic Corporation. All rights reserved.