The SendMail method queues an electronic mail message for batch delivery with attachment(s) and other options.
Syntax
SendMail(defaultMailServer, _
               fromName, _
               fromAddress, _
               priority, _
               returnReceipt, _
               toAddressList, _
               ccAddressList, _
               bccAddressList, _
               attachmentList, _
               messageSubject, _
               messageText, _
               sendHelo, _
               xheaderList, _
               reserved, _
               reserved2, _
)
NB. Note use of the underbar character for line continuation.
Parameters
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("EmailResolver.EmailResolverCtrl.1")
<%
defaultmailServer = "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)
heloName = "TWOTHEMARES"
xheaders = "Date=Mon, 31 Dec 2003 23:59:59 -0700;X-Sender=Steven Joyce"
result = mailer.SendMail(defaultmailServer, _
fromName, _
fromAddress, _
priority, _
returnReceipt, _
toAddressList, _
ccAddressList, _
bccAddressList, _
attachmentList, _
messageSubject, _
messageText, _
heloName, _
xheaders, _
"", _
"" _
)
%>
<% If "" = result Then %>
<P>
Mail has been sent.
<P>
<% Else %>
<P>
Mail was not sent, error message is
<H2>
<%= result %>
</H2>
<P>
<% End If %>
Applies To