SendX
The SendX method attempts to send an electronic mail message with attachment(s)
and other options.
Syntax
SendX(
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.
-
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!"
You cannot send an attachment from a client machine.
You can only send attachment files that are located on the server.
To be able to send client attachments using ASP from a client browser would be a gross breach of security.
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 ASPMail = Server.CreateObject("ASPMail.ASPMailCtrl.1") %>
<%
mailServer = "mailer.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 = ASPMail.SendX( mailServer, _
fromName, _
fromAddress, _
priority, _
returnReceipt, _
toAddressList, _
ccAddressList, _
bccAddressList, _
attachmentList, _
messageSubject, _
messageText _
)
%>
<% 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
OCXMail ASP Component
http://www.flicks.com/authentix/discover/main.htm