Q

The Q method queues an electronic mail message for batch delivery with attachment(s) and other options.

Syntax

Q( mailServer,      _
               fromName,      _
               fromAddress,      _
               priority,      _
               returnReceipt,      _
               toAddressList,      _
               ccAddressList,      _
               bccAddressList,      _
               attachmentList,      _
               messageSubject,      _
               messageText      _
              
)

NB. Note use of the underbar character for line continuation.

Parameters

mailServer
Specifies the name of SMTP mail server.
Version 3 and above: the mailServer parameter can be a list of multiple mailserrvers, separated by semicolons, failing over to the next in the list if the previous ones are down or unavailable.
The special mail server name "<recipient_domain>" represents the mailserver associated with the email address itself. See example below.
Note: checking the Options/"Always try the recipients mailserver first" checkbox in the Administration dialog will automatically prepend "<recipient_domain>" on your behalf, allowing existing and new deployments to seamlessly use this functionality.
fromName
The informal name of the person sending the email message. Can be empty. An error will result if both fromName and fromAddress are empty.
fromAddress
The email address of the person sending the email message. Can be empty. An error will result if both fromName and fromAddress are empty.
priority
The priority of the message. Can be empty or one of "Highest", "High", "Low", "Lowest".
returnReceipt
If empty does nothing. If it has a value of "Yes" then requests a return receipt from the recipients.
toAddressList
The email address of the person to whom the electronic mail message will be sent. Can be empty. Multiple recipients separated by a comma only. An error will result if toAddressList and ccAddressList and bccAddressList are empty.
ccAddressList
The email address of the person to whom the electronic mail message will be carbon-copied. Can be empty. Multiple recipients separated by a comma only. An error will result if toAddressList and ccAddressList and bccAddressList are empty.
bccAddressList
The email address of the person to whom the electronic mail message will be blind carbon-copied. Can be empty. Multiple recipients separated by a comma only. An error will result if toAddressList and ccAddressList and bccAddressList are empty.
attach
The file to be attached. Multiple attachments separated by a comma only. Can be empty.
messageSubject
The subject of the message. Can be empty. An error will result if both messageSubject and messageText are empty.
messageText
The text of the message. Can be empty. An error will result if both messageSubject and messageText are empty.

Return Values

Returns an empty string if the message was sent successfully. Otherwise returns a string indicating the error that occurred. Notes

If you are sending a long message and you want to format the lines, use VbCrLf (Chr(13)+Chr(10) ) to insert end-of-lines. Eg

message = "Thanks,  " & vbCrLf & vbCrLf & "it works a treat!"

Example

The following sends an email to customer197@mailer.net, with a carbon-copy to sales@mailer.net and two blind carbon-copies. There are no attachments. Priority is normal and no return receipt is requested.


<% Set mailer = Server.CreateObject("ocxQmail.ocxQmailCtrl.1") 
<%

mailServer = "<recipient_domain>;mailer1.mailer.net;mailer2.mailer.net"
fromName = "System Administrator"
fromAddress = "admin@mailer.net"
priority = ""
returnReceipt = ""

toAddressList = "customer197@mailer.net"

ccAddressList = "sales@mailer.net"

bccAddressList = "admin@mailer.net"
bccAddressList = bccAddressList & ","
bccAddressList = bccAddressList & "loggingAccount@mailer.net"

attachmentList = ""
messageSubject = "Welcome on board!"
messageText = "Welcome to mailer.net"
messageText = messageText & Chr(10)
messageText = messageText & "We hope you enjoy our services."
messageText = messageText & Chr(10)


result = mailer.Q( mailServer,      _ 
               fromName,      _ 
               fromAddress,      _ 
               priority,      _ 
               returnReceipt,      _ 
               toAddressList,      _ 
               ccAddressList,      _ 
               bccAddressList,      _ 
               attachmentList,      _ 
               messageSubject,      _ 
               messageText      _ 
               ) 
%>
<% If  "" = result Then %>
<P>
Mail has been queued.
<P>
<% Else %>
<P>
Mail was not queued, error message is
<H2>
<%= result %>
</H2>
<P>
<% End If %>


 

Applies To

ocxQmail ASP Component