SendToQueue Method


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

MailBee Message Queue (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. MailBee.NET Queue is a modern version, it adds SSL/TLS support, direct send without SMTP relay server, and many other features. MailBee.NET Queue, however, needs .NET Framework. From the point of view of MailBee SMTP component, both versions behave identically.

IIS SMTP server is also capable of bypassing SMTP protocol and picking messages directly from the file system.

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.

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. However, IIS SMTP pickup service cannot double first dots on a line as required by the SMTP protocol and thus it's the responsibility of the application which produces .EML files.

In short, before submitting to IIS SMTP pickup service, set IsQueueIIS property value to True.

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.


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) or by MailBee.NET Queue (the default is "c:\MailBeeNetQueue Files\Pickup")  
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
IsQueueIIS Property

SendToQueueEx Method


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.