Netro: AspMail 3

Netro Settings

Important, take note:
Mailer.RemoteHost = ""

About AspMail

AspMail allows you to send mail using the standard SMTP protocol from any program that can use ActiveX/OLE components. Features include:

  1. SMTP (sending) Messages
  2. Multiple File Attachments
  3. File attachments support MIME and UUEncoding
  4. US Ascii and ISO-8859-1 character sets
  5. PGP
  6. Subject line encoding for 8bit message subjects
  7. Redundant SMTP servers (If the primary SMTP server is down, the secondary server is used)
  8. Special Header Support (Standard X-Priority headers, MS Mail (including Exchange) priority headers, Urgent header, ConfirmReading and ReturnReceipt Headers)
  9. Multiple concurrent users (Tested with 15 concurrent connections)

Changes in AspMail 3.0

  1. Better support for MTS. Transactions are not supported in the 3.0 release but you should be able to incorporate AspMail into MTS packages without any troubles.
  2. Better COM support. AspMail is now more compatible with VC, VFP, VB, PowerBuilder and other development systems besides ASP.

Simple Mail Example

Using the component is as simple as

  1. Creating the object
  2. Setting a few properties
  3. Calling the SendMail method

The following code demonstrates how to use AspMail from VBScript. In this example Joe from Joe’s Widgets wishes to send an email to John Smith. Joe’s mail server is located at

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName   = "Joe’s Widgets Corp."
Mailer.FromAddress= ""
Mailer.RemoteHost = ""
Mailer.AddRecipient "John Smith", ""
Mailer.Subject    = "Great SMTP Product!"
Mailer.BodyText   = "Dear Stephen" & VbCrLf & "Your widgets order has been processed!"
if Mailer.SendMail then
  Response.Write "Mail sent..."
  Response.Write "Mail send failure. Error was " & Mailer.Response
end if

By testing the result of the SendMail method we can determine if the mailing process was successful or not.

Form Handling

All or partial input for a message may come from a form. For example, a form posted to the server with a request method of GET (i.e. <form action="/scripts/AspMail.asp" method=get>) may provide the message recipient’s email address, subject and message text as follows:

Mailer.AddRecipient Request.QueryString("ToName"), Request.QueryString("ToAddress")
Mailer.Subject   =  Request.QueryString("Subject")
Mailer.BodyText  = Request.QueryString("MsgBody")

The form may also use the POST method (i.e. <form action="/scripts/AspMail.asp" method=post>) in which case the code would look as follows:

Mailer.AddRecipient Request.Form("ToName"), Request.Form("ToAddress")
Mailer.Subject   =  Request.Form ("Subject")
Mailer.BodyText  = Request.Form ("MsgBody")

You can use any mixture of static and dynamic data in setting the components properties as dictated by your needs. For example, you may wish to send the mail to a single user. In this case you could modify the code to look something like this:

Mailer.AddRecipient "John Smith", ""
Mailer.Subject   =  Request.QueryString("Subject")
Mailer.BodyText  = Request.QueryString("MsgBody")

Generic Form Handling

In some cases users may wish to use a number of different forms to send email with the same block of code. ASP allows you to loop through each QueryString or Form variable and append each one to string variable which is then assigned to the BodyText property.

strMsgHeader = "Form information follows" & vbCrLf
for each qryItem in Request.QueryString
   strMsgInfo = strMsgInfo &  qryItem & " - " & request.querystring(qryItem) & vbCrLf
strMsgFooter = vbCrLf & "End of form information"
Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter

To return form contents in the original form order your code might be...

strMsgHeader = "Form Information Follows: " & vbCrLf
for i = 1 to Request.Form.Count
  strMsgInfo = strMsgInfo & Request.Form.Key(i) & " - " &  Request.Form.Item(i) & vbCrLf
strMsgFooter = vbCrLf & "End of form information"
Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter

Setting Mail Priority

There are a couple of headers that can be modified to set message priority.

The Priority property sets the message priority on a scale of 1 to 5. A priority of 1 means HIGH. A priority of 3 means NORMAL and a priority of 5 means LOW. In addition to this you can also set the Urgent property if the message status is urgent. The Urgent property is a true/false property.

How to Use the DateTime Property

The component creates a Date/Time value for the message based on the calculated GMT time. The DateTime property was added to allow users to set a custom date/time timezone. The following code demonstrates how to set the DateTime to US Central Standard Time. By slightly altering the values underlined you can adjust this to work for your timezone.

[set other Mailer properties]
Mailer.DateTime = WeekDayName(WeekDay(Date), true) & ", " & Day(Date) & " " & MonthName(Month(Date), true) & " " & Year(Date) & " " & FormatDateTime(Now, 4) & " -0600 (CST)"

Notes About Creating the Mailer Object

You can create the mailer object at two different points in time:

You will have to decide when and where it is appropriate to create the object based on your particular application. If you aren't sure which way to create the object reference, or for typical usage, you should create the object immediately before sending your email. Your code would look like this:

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
... [Set properties]
if Mailer.SendMail then ...

Creating these local references, as demonstrated above, allow you to use the object on multiple application threads at the same time.

To create an object reference at the session level, your code might look something like this:

if Not IsObject (session("Mailer")) then
  Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
  Set session("Mailer") = Mailer
  Response.write "Cached session object reference being used<p>"
  Set Mailer = session("Mailer")
end if

Multiple Host Support

AspMail provides one host property to set up remote SMTP server addresses. The RemoteHost property should be set to your primary and secondary server’s address separated by semicolons. In the event that the primary server is down, AspMail will attempt to use the secondary server. For example,

Mailer.RemoteHost = ";"

PGP Support

AspMail now supports PGP. See the pgpmail.asp script for an example of usage. ServerObjects Inc. is not responsible for PGP support. If you have questions about PGP please contact the developers of PGP. PGPMail.asp is part of the AspMail evaluation zip file.

Questions about AspMail

See for general ASP support errors and issues.

Download our troubleshooting utility for help with configuration problems.

How do I determine a cause of mail failure?


The message is sent but I never receive it. What's wrong?


It's been working fine for 3 years and now it appears that the messages are not getting delivered.

Note about FromAddress: You must specify a value for the FromAddress property. Mail failure will occur without a FromAddress.

If the component can determine why the SendMail method failed, that information will be stored in the Response property. So, for example, to print that information to the clients browser you could add the following code:

if not Mailer.SendMail then
  if Mailer.Response <> ''" then
    strError = Mailer.Response
    strError = "Unknown"
  end if
  Response.Write "Mail failure occured. Reason: " & strError
end if

Another fairly common problem is when a user reports that a specific feature is not working. For example BCC's may seem to never reach their destination. A valuable debugging tool is available with the SMTPLog feature. Assign a valid filename to this property and the contents of the SMTP transaction that occurs during a SendMail call will be recorded to this file. I

f you find that the SMTP transaction occurs without error then you should check elsewhere for the cause of mail delivery failure. Invariably the user finds that the BCC address was invalid or that the SMTP server is not relaying mail for the recipient domain. 

The SMTPLog feature allows you to verify if the transactions are complete and valid before pursuing other avenues in determining the cause of failure. If you see no errors in the SMTPLog then you need to check downstream of AspMail starting with the SMTP server you are using to send, as well as the recipient SMTP server. Anti-spam features on either machine may be identifying your message as spam and may need to be reconfigured. Check with the SMTP server administrators.

Checking the Mailer.Response property returns

"File Access Denied"


"Cannot create file"


"I have a TMP/TEMP var but it still isn't working"

What's wrong?

You probably don't have a TMP or TEMP path set up, or if you do, the IIS User (or any users authenticating under IIS) don't have read/write access to the this directory.
  1. Make sure the directory exists.
  2. Make sure the TMP or TEMP variable exists in your NT/Win95 environment. Under NT this must be a system environment variable, not a user environment variable. If TShoot (see our tech support page) doesn't show the var it isn't a system var. It must be a system var.
  3. Make sure all users which need access to the component (the anonymous IIS user and any other users which authenticate under IIS) have read/write access to this path.

How to determine where your TMP/TEMP dir points to

AspMail versions 2.5.8 and higher have a method called GetTempPath. To display where your TMP path is set to place the following code in an ASP script and run it.

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Response.Write Mailer.GetTempPath

Your Win32 OS is designed to find your temporary path in the following manner:

  1. Check for TMP.
  2. If it does not exist, check for TEMP.
  3. If it does not exist use the current directory. ASP tends to use the \WinNT directory in this case.
What would cause an "Operation timed out error"?


"AspMail has been working great but suddenly I'm getting an 'Operation timed out' error.

Reasons for operation timed out include:
  1. SMTP server is down, overloaded or simply not responding
  2. Firewall blocking port 25 between AspMail and SMTP server
  3. Packet filtering blocking port 25 between AspMail and SMTP server
  4. IP route is down
  5. Your Winsock configured DNS server is down

To check using another method run

telnet [smtp hostname] 25

from the IIS server where AspMail is installed. If telnet can see the
SMTP server, then AspMail can see the server also.

I'm adding attachments but they aren't getting added to the actual mailing. What's wrong?
  1. The path specified is not valid.
  2. The user the component is running under, typically the anonymous IIS user, does not have rights to open the file. The anon IIS user, by default, cannot read from networked drives so a path such as \\foobar\files\ is not valid.
  3. The file is open by another process that's denying reads to the file.
I'm adding files from an array. All but the last file are getting added, no matter how many files I add. The last array element filename probably has a chr(0) appended to the end. You'll have to delete the final character of the filename before calling AddAttachment.
Is there a comprehensive list of errors that can be returned by AspMail? There are quite a few errors that can be returned. We do not have a comprehensive list, primarily because these errors are returned from systems AspMail is dependent on. The errors can come from your SMTP server (errors vary from vendor to vendor), from WinSock errors (documented by Microsoft) and general OS errors such as out of memory, disk read/write failures etc... (again documented by Microsoft).
"AddCC or AddBCC doesn't work" - is this a bug with AspMail?


"I'm adding multiple recipients but only the first one is getting delivered. What's wrong with AspMail?"

AddRecipient, AddCC and AddBCC work just as they should. The problem is not with AspMail. It is likely that your SMTP server is rejecting "foreign addresses" (see "no relay" question below).

To test whether AspMail is functioning properly use the SMTPLog property to capture an SMTP session with multiple recipients. All the recipients you send to should appear in the log as the SMTP envelope is sent. If they all appear then the problem is with your SMTP server or an SMTP server down the stream (or your addresses are invalid).

The syntax

Mailer.AddRecipient = "name", ""


Mailer.AddRecipient =  ""

both return a VBScript error. What's wrong?

First off, remove the = sign. AddRecipient sounds like and is actually a method, not a property. Also AddRecipient takes two parameters. See AddRecipient in the methods listing for details.
What's the syntax for adding multiple recipients? Call AddRecipient, AddCC or AddBCC for each recipient. There's no other way to add multiple recipients.

Mailer.AddRecipient "name1", "address1"
Mailer.AddRecipient "name2", "address2"
Mailer.AddBCC "name3", "address3"

How do I define the sensitivity of the message? Outlook allows you to define a message sensitivity. You can do this using as mail by adding the sensitivity header along with the proper text for the sensitivity header.

For example:

Mailer.AddExtraHeader "Sensitivity: Company-Confidential"

How do I create a hyperlink in my message? Set Mailer.ContentType = "text/html" and include the hyperlink just like you would with html.

<head><title>AspMail HyperLink</title><head>
<H3>AspMail HyperLink</H3>
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "Status Update Report"
Mailer.FromAddress = ""
Mailer.RemoteHost = "your.smtp.server"
Mailer.AddRecipient "Your Recipient", ""
Mailer.Subject = "AspMail Hyperlink"
Mailer.ContentType = "text/html"
Mailer.BodyText = "<html><body>Here's some <a href="""">info</a></body></html>"
if Mailer.SendMail then
  Response.Write "Mail sent..."
  Response.Write "Mail failure. Check mail host server name and tcp/ip connection..."
  Response.Write "<p>" & Mailer.Response
end if

How do I create a line-break in a message? Under VBScript you can use the predefined constant VBCrLf. Simply using a Chr(13) or a Chr(10) will not work --you must use both -- the VBCrLf defined constant is the preferred method. A Carriage-return and line-feed character are required to create a new line in the message. See the sample scripts for examples.
How do I send multipart text and html messages so that text viewers can read the message and HTML enabled email clients can see and HTML version? See the file multmail.asp that is located inside the AspMail zip file. Do not write ServerObjects for a copy. Download the zip file for AspMail from the ServerObjects Web site if you need a copy.
"Do I need to install SMTP on my server?" AspMail "knows" how to talk SMTP without any external dependencies. You do not need to have Exchange or other products installed (outside of the OS) for AspMail to work.
How do I set the username and password to send mail? Standard SMTP does not use a uid/pwd so it isn't needed. The protocol used to retrieve mail, POP3 typically requires a uid/pwd but AspMail doesn't use POP3 since it is a send mail component.
What versions of PGP does AspMail support? AspMail can support any encryption program that uses command-line parameters. Using PGPPath and PGPParams you can specify input, output and processing options. The current version of PGP (5.0) does not support command-line parameters but the commercial PGP 4.x does as well as the freeware (non-commercial use) PGP 2.6.2.
How do I troubleshoot PGP usage?
  1. Check permissions on the pgp.exe. The anon IIS user (if you are calling PGP from that user account) will need rights to read and execute files from the PGP directory.
  2. Verify the path and params you are setting up to call PGP.
  3. Use task manager to see if PGP is getting executed on the server.
  4. Check the Mailer.Response property immediately after you call GetBodyTextFromFile to see if any O/S errors are getting returned by the call to PGP.
  5. If the error returned in the Response property indicates that file access was denied, or that there was a file access timeout you need to find out...
    1. If the file is getting created in the path specified.
    2. What has the file open. You can use Filemon for Windows NT and HandleEx from Systems Internals to help debug these issues.
My mail to AOL is bouncing. What am I doing wrong? AOL will not accept anything other than a true address in the "From:" heading. Just about every mail system out there, except AOL and Compuserve, will accept the "No Mail Address" as the "From:" header. (thanks to R.S for this info).
I want to create a mail service like HotMail or Yahoo Mail. Do you have script code that would serve as a basis for this? No. We only provide the AspMail and AspPOP3 components. You will have to either write the code yourself or find a consultant to do it for you.
I want to use AspMail from VB, FoxPro or [insert name here].

The product page has several examples of usage from other languages. Be sure you are using AspMail 3.x since this version corrects a problem some users reported with previous versions.

Does AspMail support 8bit messages?


"does AspMail support Japanese character set"

AspMail supports any 8 bit characters but please note:
  1. Message bodies may be 8bit.
  2. Some SMTP servers drop the 8th bit in message headers including Subject lines.
  3. You can encode message subjects using a new method named EncodeHeader. See the methods listing for details. Some character sets don't work properly using this method, some do. We don't have any support for character sets that don't work properly using this encoding.
  4. SHIFT-JIS reportedly works fine with the EncodeHeader method.
Can I repeatedly assign values to the BodyText property? and "The message text keeps growing with each email I send." Yes, the text will be appended to the message. Use ClearBodyText if you need to clear the message text.
How many recipients can I add to a message? To Recipients: 65K; CC's: 65K; BCC's: 65K. But many SMTP servers won't handle that many so we suggest you reduce the # per message sent.
Can AspMail be used to retrieve files off the client computer? AspMail is a server-side component. Retrieving files from the client computer requires a client-side component that has access to the client's local harddisk or a browser that supports file uploads in addition to a server side component/extension that can accept those files. AspMail does not support this function.
How do I get Exchange to route Internet email to the Net? Exchange uses a service called the Internet Mail Connector (IMC) to allow it to act as an SMTP server and transmit and receive mail via a TCP/IP network. If you are not running the IMC you will not be able to send or receive mail from the Internet by AspMail or any other means.

Once you have SMTP mail going with the IMC, no further action should be necessary to use AspMail. (Thanks to Steve Crane for this information).

Note: You must enable the rerouting on your Exchange's Internet Mail Connector. Go in the properties of your Internet Mail Services (Exchange 5.0). Check the reroute incoming SMTP mail option and add a route to your domain. Mail sent to "" should be accepted as "inbound". Thanks to Sébastien Stormacq for this information.

How do I upgrade to the latest version? Download the latest "eval" version and follow the upgrade directions provided earlier in this document.
Can I redistribute this control with my products? The license agreement does not permit redistribution of AspMail.
The SMTP server is reporting back a "no relay" error. What's wrong?

also "foreign traffic not accepted" and other similar messages...

The SMTP server is looking at your FromAddress and determining that it doesn't know who you are. Some SMTP servers are configured to disallow the "relaying" or transfer of mail originating from addresses outside of its own domain. The only solution is to provide a FromAddress that's local to the SMTP server's domain or get the operator of the SMTP server to allow the FromAddress you are using. This setting is commonly used by ISP's to prevent spammers from using their resources.
What does the error "socket not connected" mean? This error occurs when the remote SMTP server abnormally closes the Winsock connection that AspMail established. The reasons may include an SMTP server that is not functioning properly (misconfigured or failing). In some cases this error can be generated by a Winsock layer that is failing. To test your local server, reboot the server and try to run the script again. If the error continues to occur it is likely that some sort of configuration problem or failure is occurring on the SMTP server.
What does error "554 No valid recipients" mean?


"503 Need RCPT (recipient)"

500 series errors are errors that the SMTP server generates. This error means that the message recipients given are either not given (you didn't use AddRecipient, AddCC or AddBCC) OR they are not valid recipients for this SMTP server. This is often associated with the "no relay" issued covered above. The SMTP server rejects the given recipients and then issues this error. This typically happens when you have IgnoreInvalidRecipients set to true. You can verify that the SMTP server is ignoring your recipients due to the "no relay" issue or for any other reason by using the SMTPLog property to generate a log and then look at the rejection errors in the log file.
Some of our emails are getting equal signs at the end of lines in some messages. Why?
AspMail can encode high characters using a scheme where the = sign
indicates a character to be decoded follow by the hex string value of
the character to be encoded. This system of course assumes that the client can decode these characters (which most can). This is called quoted-printable encoding. The default for AspMail is not to use QP encoding. Things that trigger automatic QP encoding:
  1. High characters - characters with the following ordinal values 0..31,61,128..255
  2. Long lines of a message body (you can turn wordwrap on to fix this case)

Most clients are capable of handling QP encoding. If your client is not capable then you should upgrade your client or you must work within the above limitations to prevent the QP encoding from occuring.

Sometimes I get multiple messages sent when I call SendMail. Why? AspMail has an internal routine to look for errors. If an error occurs at any point (even after the text of the message has been sent to the SMTP server) AspMail will go ahead and attempt to send it a second time in an attempt to complete the SMTP transaction without any errors if, and only if, you have multiple RemoteHosts set up in the RemoteHost property. The AspMail routine will only attempt 1 retry in this case.

If you only have one host name setup then the problem will be found in #1) your calling SendMail more than once or #2) you are not handling cases where the user does a double-click on his/her browser.

How do I specify the Return-Path header in a message? Mailer.AddExtraHeader "Return-Path: your_route-addr"
With AspMail can I have "required fields" on my HTML forms or other form processing functionality. Can AspMail change the order I get form field data back?
  1. Microsoft's ASP, not AspMail controls form data order. If you are looping through the form data in ASP order it probably won't be the original form order. You'll have to hard code field names to force the data back in a specific or original form order.
  2. Required fields are a function of HTML and client side scripting, not AspMail. If you used a CGI library in the past that handled those issues for you, it what only because they delved into areas outside of SMTP/Mail. AspMail's only function in life is to send mail. It does not handle client side HTML/scripting.
"Can someone use AspMail to send SPAM through our system?" AspMail does not accept SMTP connections and therefore cannot be used to relay SMTP traffic. AspMail can generate new SMTP message traffic but only if you provide a script page to generate it. Therefore it is under the Web operator's control.
WebTrends is generating multiple messages when its schedule runs. WebTrends is probably parsing your Web tree and calling the HTML and ASP scripts to determine what they are. In the process the ASP scripts you have that call AspMail may be getting called at the same time. Your options are:
  1. You are going to have to configure WebTrends not to call these scripts. - or -
  2. Modify your scripts so that if WebTrends is calling them they don't fire off a message. - or -
  3. Contact WebTrends for another solution. AspMail can't control WebTrends.
My component is registered. Should the Expires property return a date? No. Registered versions return N/A for an expiration date. The registration process (per the instructions you received) should be run on the server.
I'm mailing a large number of people. At some point in the mailing it fails. Can you give me any tips? The first tip is to use the SMTPLog property to write an SMTP log to disk and see what the point of failure is based on the log. The SMTP server is probably rejecting your message for some reason and the cause is typically determinable from the log.

Secondly, some SMTP servers only accept mail for locally known recipients. The SMTP server may be rejecting your message since it is being addressed to recipients outside the domain of that SMTP server. This is unusual but could possibly be the problem you are running into.

Using the SMTPLog property I got an error #132. How can I look up numeric errors returned by AspMail to find out what it means? TShoot under the file menu has a Win32 error code lookup form.
What are some of the issues that affect the speed of the mailing? A small message should take 3-4 seconds to send if the server is local and all other conditions are normal. The following list are some items that can affect transfer speed.
  1. The slower the TCP connection the longer the mailing will take. Typically a local server is much faster than a remote server. If you are losing packets between your server and the SMTP server you can expect longer times due to this packet loss.
  2. The size of the mailing. The larger the message the longer the message transfer will take to send.
  3. CPU utilization: If your CPU is experiencing heavy usage you can expect it to take longer to transfer mail.
  4. SMTP server utilization: If your SMTP server is experiencing heavy traffic response times from the server are going to take longer thus increasing the time it takes to send a message.

One thing we've found is that by changing the RemoteHost name from a hostname to an IP address can cut 3 or 4 seconds off some messages. Even if the RemoteHost name is set to the local server's name, we've found some messages waiting for the hostname lookup. Just change the address to an IP and you may see an increase in the speed.

Is there a limit to the length of email addresses. AspMail support longer email addresses than anyone has so there are no practical limits. If your email is not being delivered see the previous questions for pointers on how to troubleshoot mail failures.
Does the 2 CPU license cover two servers or two processors? In accordance with the license agreement, the 2 CPU license would cover either 2 single CPU servers or 1 dual CPU server. With this pricing model, AspMail is far more inexpensive than any "competing" products.

Technical Support

If you require technical support please see our tech support page at

AspMail Properties

Property Description
BodyText The message body text. To clear the text once you have set it use the ClearBodyText Method.


Mailer.BodyText = "Your order for 15 widgets has been processed"

CharSet The character set. By default the char set is US Ascii

Valid values:

  • 1 = US ASCII
  • 2 = ISO-8859-1


Mailer.CharSet = 2

ConfirmRead The ConfirmReading flag. If this is set to true AND the recipients email program supports

this feature (and it is enabled) the recipients email program will send a notice back to the FromAddress confirming that this email has been read.


Mailer.ConfirmRead = true

ContentType The ContentType property allows you to set the ContentType header of the message's BodyText. If, for example, you wanted to send HTML as the messages's body, you could set ContentType = "text/html" and EMail programs that support HTML content could properly display the HTML text.

Note: The ContentType property is ignored if you have file attachments.


Mailer.ContentType = "text/html"

CustomCharSet If you wish to use a character set besides the included types you can set CustomCharSet to a character set string.


Mailer.CustomCharSet = "ISO-2022" or
Mailer.CustomCharSet = "big5"

DateTime AspMail will, by default, create a Date/Time header for your local system using GMT. If you would like to override the date/time calculation set the DateTime property to a valid date/time string in the format defined by RFC 822 & RFC 1123.


Mailer.DateTime = "Fri, 02 May 1997 10:53:49 -0500"

Encoding The encoding type for attachments. The default setting is MIME.

Valid values:

  • 1 = UUEncoded
  • 2 = MIME


Mailer.Encoding = 1

Expires If the component is an eval version the expires property will return the date that the component quits functioning.


Response.Write "Component Expires: " & Mailer.Expires

FromName The message originator’s name.


Mailer.FromName = "Joe’s Widget Shop"

FromAddress The message originator’s email address.


Mailer.FromAddress = ""

IgnoreMalformedAddress Defaults to false. When false AspMail will check for '@' in the email address for calls to AddRecipient, AddCC and AddBCC. An error would be returned in the Response property. When this property is set to true AspMail will not perform any address syntax validation. If you are using AspMail to send a message through an SMS gateway or fax system you may need to set this property to true.
IgnoreRecipientErrors Defaults to true. If true AspMail will ignore error messages returned by the SMTP server for invalid addresses. This is useful when a mailing is addressed to a number of recipients.
Live Live allows you to test the component without an SMTP server. If Live is set to false then the NET SEND message will be executed with the FromName property being used as the recipient of the message. Only the subject is sent to the recipient.


Mailer.FromName = "ASPProgrammer"
Mailer.Live = false

Organization Sets the Organization header in the message.


Mailer.Organization = "Your Company Name"

PGPPath The path where PGP is located.
PGPParams Parameters that PGP will use to process message.
Priority Sets the message priority. Priorities are 1-5 and are reflected in the X-Priority

Valid values:

  • 1 – High
  • 3 – Normal
  • 5 – Low


Mailer.Priority = 1

RemoteHost The remote SMTP host that the message will be sent through. This is typically an SMTP server located at your local ISP or it could be an internal SMTP server on your companies premises. Up to 3 server addresses can be specified, separated by a semicolon. If the primary server is down the component will attempt to send the mail using the secondary server and so on.


Mailer.RemoteHost = "" or

Mailer.RemoteHost = ";"

ReplyTo The ReplyTo property allows you to specify a different email address that replies should be sent to. By default mail programs should use the Reply-To: header for responses if this header is specified.
Response The Response property returns any error messages that may occur.
ReturnReceipt The ReturnReceipt flag. If this is set to true AND the recipients SMTP server supports

this feature (and it is enabled) the recipients SMTP server will send a notice back to the FromAddress confirming that this email has been delivered.


Mailer.ReturnReceipt = false

SMTPLog If you need to debug the session give a log file name here. Make sure the IUSR_XYZ IIS user has security that allows the component to write to this file. Warning: Do not use this setting in situations where multiple users can access this component at the same time. This is for single user debugging ONLY!


Mailer.SMTPLog = "c:\smtplog.txt"

Subject The message subject.


Mailer.Subject = "Stock split announced!"

SuppressMsgBody The SuppressMsgBody property is true by default and is used in conjunction with the SMTPLog property. When SMTPLog is set to a file and SuppressMsgBody is true the log file receives a copy of the message text. If SuppressMsgBody is false the message text is not sent to the log.
TimeOut Timeout is the maximum time that AspMail should wait for a response from the remote server. The default is 30 seconds.


Mailer.Timeout = 15

Urgent The urgent flag sets the X-Urgent header in the outgoing message. Not all mail readers support this flag.


Mailer.Urgent = true

UseMSMailHeaders MS-Mail priority headers, by default, are sent in addition to the standard SMTP priority headers. You can turn MS-Mail headers off with this property


Mailer.UseMSMailHeaders = false

Version Gets the internal component version number.


Response.Write "Component Version: " & Mailer.Version

WordWrap The WordWrap property is off by default. Setting WordWrap to true causes the message body to wordwrap at the position specified by the WordWrapLen property.
WordWrapLen The WordWrapLen property is set to 70 by default. You can modify the position that wordwrap occurs by changing this value.

AspMail Component Methods

Method Parameters Return Value Description
SendMail None True or False


if Mailer.SendMail then

Response.Write "Mail sent..."


Response.Write "Mail failure. Check mail host server name and tcp/ip connection..."

end if

The SendMail method attempts to send the email.
AddRecipient Mailer.AddRecipient "Jay Jones", "" True/False based upon success or failure. Adds a new recipient, as shown in the message's To: list.
ClearRecipients None None Clears any recipients assigned to the To list.
AddCC Mailer.AddCC "Jay Jones", "" True/False based upon success or failure. Adds a new recipient, as shown in the message's CC list.
ClearCCs None None Clears any recipients assigned to the CC list.
AddBCC Mailer.AddBCC "Jay Jones", "" True/False based upon success or failure. Adds a new Blind Carbon Copy recipient. BCC recipients are not shown in any message recipient list.
ClearBCCs None None Clears any recipients assigned to the BCC list.
ClearAllRecipients None None Clears all recipients assigned to the To, CC and BCC lists.
AddAttachment Filename to attach to message.


Mailer.AddAttachment "d:\shipping\"

N/A Adds attachments to current mailing. You must use an explicit path to attach files.

Make sure that the IUSR_XYZ IIS user, or the authenticated user has security rights that allow the component to read the necessary files! Note: Attachments may not be supported in some eval versions.

ClearAttachments None None Clears any attachments that were previously set.



ClearBodyText None None Clears any text assigned to the message’s body which may have been set previously by using the BodyText property.
ClearExtraHeaders None None Clears any X-Headers that were set by use of AddExtraHeader.
AddExtraHeader A string value that forms a proper SMTP X-Header


("X-HeaderName: XHdrValue")

True or false. Returns true if X-Header was added. Adds extra X-Headers to the mail envelope.
GetBodyTextFromFile See pgpmail.asp for more information. See pgpmail.asp for more information. Loads message's body text from a file. Optionally runs PGP on the message text.

See pgpmail.asp for more information.

EncodeHeader strValue strValue encoded as String Encodes a string in RFC1522 format to provide support for 8bit mail headers such as 8bit subject headers.


Mailer.Subject = Mailer.EncodeHeader("Résponse de Service à la clientèle")

GetTempPath N/A strPath Returns the path set up by the OS for temporary mail files. See the discussion on TMP env variables for more information.


Copyright © 1996, 1997, 1998, 1999, 2000 by ServerObjects Inc. All Rights Reserved.