Home Site Map Buy Email
AdvSMTP
AdvIMAP4
AdvPOP3
AdvFile
AdvZIP
AdvGraphGenerator
AdvLDAP
AdvHTTP
AdvDSN
AdvDirectory
AdvRegistry
AdvMX
ASP Components >> AdvSMTP
see also CF_MAIL
Download | Buy
AdvSMTP
The easy, reliable and cost-effective way to build or support SMTP applications... If you are looking for an easy to use and reliable SMTP component -- you have found the source!

AdvSMTP is the basic component used to send e-mail using Simple Mail Transfer Protocol (SMTP). Supports multiple file attachments, multiple recipients, CCs, BCCs, plain/HTML message, US ASCII/ISO-8859-1 character sets. It does not require a SMTP server to execute. Access to the component can also be turned on or off for a specific website like all other ASPFusion components. AdvSMTP is one of the most advanced components for sending mail messages. AdvSMTP dramatically increases the performance and dependability of your e-mail enabled applications by intercepting, sorting, queuing, and delivering outbound e-mail in the background. It can be used to create and send professional plain-text or HTML emails. Other features are

It sends email messages using IP address of a specific website instead of using server IP address. Which eliminates chances of server IP address getting blocked for any spam complaints (a new feature).
CC and BCC.
Multiple attachments
Embedded images (a new feature provided by the component).
Chinese and other languages support and many other features like this.
Along with these basic operations, it provides Upload and UploadAs operations. Upload operation allows uploading single or multiple files at a time form client browser to the server. It also allows resolving the problem of name conflicting through the property NameConflict with possible values as Error (default), Skip, OverWrite and MakeUnique. UploadAs operation allows uploading single or multiple files at a time form client browser to the server with specified name. Only few lines of code is
No need to specify any external SMTP server for sending mail messages. Component will lookup for recipient's SMTP server and will send mail directly to reciepient's SMTP server without using any external SMTP server (a new feature).
Both plain TEXT body and HTML body can be specified separately using two different methods.
The component can also perform logging for all sent mail messages.
We have spent years building SMTP components and e-mail softwares. We have put all the experience into it, this component is specifically designed keeping in view all the technical and user friendliness aspects. Using our component ...

Increase the Throughput
CC and BCC.




The component send mail messages in two different ways.

Blocking way, in which caller has to wait for the response from the component.
Non Blocking way, in which component returns control back to the caller and places a mail file in Spool folder, AdvSMTP service running at backend is then responsible to send all spooled mail messages.






ASPFusion also provides ColdFusion custom tag CF_MAIL written on AdvSMTP component. This helps coldfusion developers in making a better understanding, in case they are using AdvSMTP component.

Sample code for C++, ASP and CF is provided with the component.

Example (ASP):

<% set Obj = Server.CreateObject("AdvSMTP.SMTP") %>

Example (ColdFusion):

<CFOBJECT Class="AdvSMTP.SMTP" Action="Create" Name="Obj">

AdvSMTP Properties

Property Description
BCC The address(s) to whom, the blind carbon copy should be sent, can be specified through this property. For multiple recipients, it will be semicolon ";" separated list of addresses.

Example (ASP):
<% Obj.BCC = "support@aspfusion.net" %>

Example (ColdFusion):
<CFSET Obj.BCC = "support@aspfusion.net">
Body This property is used to assign body of the mail message. Embedded images can also be sent within the body using a special tag <AdvImageMail: Image Path | Delete Flag>, where as Image Path is the complete image path to be embedded and Delete Flag is the flag used to specify whether to delete the embedded image after mail is sent, if its value is '0' then component will not delete the image and if its value as '1' then component will delete the image after mail is sent, i.e. <AdvImageMail: c:\myfolder\myimage.gif|0>.

Example (ASP):
<% Obj.Body = "this is body of the mail message" %>

Example (ColdFusion):
<CFSET Obj.Body = "this is body of the mail message">
CC The address(s) to whom, the carbon copy should be sent, can be specified through this property. For multiple recipients, it will be semicolon ";" separated list of addresses.

Example (ASP):
<% Obj.CC = "docs@aspfusion.net" %>

Example (ColdFusion):
<CFSET Obj.CC = "docs@aspfusion.net">
CharsPerLine This property is used, if mail sender wants to set characters per line. If it is not specified then default 76 characters per line is used. Minimum characters per line allowed are 60. If number of characters assigned to this property are less than minimum allowed characters per line then component will not generate any error but will use default value.

Example (ASP):
<% Obj.CharsPerLine = 70 %>

Example (ColdFusion):
<CFSET Obj.CharsPerLine = 70>
Count This property is used to retrieve total number of uploaded files after using Upload or UploadAs methods.

Example (ASP):
<% Response.Write Obj.Count & " file(s) uploaded successfully" %>

NOTE: Can only be used for ASP.
DNSServer This property is used, if mail sender wants to send mail directly by setting Lookup property and want AdvSMTP component to perform lookup through specified DNS server. If this property is not set then system's default DNS server is used to perform lookup.

Example (ASP):
<% Obj.DNSServer = "dns1.dc.msft.net" %>

Example (ColdFusion):
<CFSET Obj.DNSServer = "dns1.dc.msft.net">
DNSTimeout It is used, if mail sender wants to send mail directly by setting Lookup property and want AdvSMTP component to set timeout while performing lookup through DNS server. If this property is not set then default DNS server timeout value is used to perform lookup.

Example (ASP):
<% Obj.DNSTimeout = 5 %>

Example (ColdFusion):
<CFSET Obj.DNSTimeout = 5>
ErrorReason Reports any error that occurred during the request.

Example (ASP):
<% if Obj.IsError = 1 then
        Response.Write Obj.ErrorReason
else
        No Error Occurred
end if %>

Example (ColdFusion):
<CFIF #Obj.IsError# EQ 1>
        <CFOUTPUT>#Obj.ErrorReason#</CFOUTPUT>
<CFELSE>
        <CFOUTPUT>No Error Occurred</CFOUTPUT>
</CFIF>
Form This property is used to retrieve the value for given form variable after using Upload or UploadAs methods.

Example (ASP):
<% Response.Write Obj.Form("submit") %>

NOTE: Can only be used for ASP.
Helo This property is used to specify host name of the sending e-mail for the SMTP HELO command. If not specified then system name is used as host name.

Example (ASP):
<% Obj.Helo = "aspfusion.net" %>

Example (ColdFusion):
<CFSET Obj.Helo = "aspfusion.net">
HTMLBody This property is used to assign HTML body of the mail message. Embedded images can also be sent within the body using a special tag <AdvImageMail: Image Path | Delete Flag>, where as Image Path is the complete image path to be embedded and Delete Flag is the flag used to specify whether to delete the embedded image after mail is sent, if its value is '0' then component will not delete the image and if its value as '1' then component will delete the image after mail is sent, i.e. <AdvImageMail: c:\myfolder\myimage.gif|0>.

Example (ASP):
<% Obj.HTMLBody = "this is HTML body of the mail message" %>

Example (ColdFusion):
<CFSET Obj.HTMLBody = "this is HTML body of the mail message">
IPAddress It is the network address of the connected socket, a dotted number such as "128.56.22.8". If not specified then system's default network address is used.

Example (ASP):
<% Obj.IPAddress = "192.168.0.100" %>

Example (ColdFusion):
<CFSET Obj.IPAddress = "192.168.0.100">
IsDefined This proprty is used to check whether a form variable exists or not after using Upload or UploadAs methods. Property returns 1 if it exists otherwise 0.

Example (ASP):
<% if Obj.IsDefined("submit") then
        Response.Write Obj.Form("submit")
else
        Form Variable Not Defined
end if %>

NOTE: Can only be used for ASP.
IsError Returns 1 if any error occurred during the request otherwise 0.

Example (ASP):
<% if Obj.IsError = 1 then
        Response.Write Obj.ErrorReason
else
        No Error Occurred
end if %>

Example (ColdFusion):
<CFIF #Obj.IsError# EQ 1>
        <CFOUTPUT>#Obj.ErrorReason#</CFOUTPUT>
<CFELSE>
        <CFOUTPUT>No Error Occurred</CFOUTPUT>
</CFIF>
LogFile This property is used to specify log file to perform logging. If mail sender wants AdvSMTP to perform logging in specified file then log file can be specified using this property. AdvSMTP performs logging in CSV format which can easily be imported to any database and can easily be parsed out. If Logging property is assigned a value 1 or 2 then you must assign log file to this LogFile property, otherwise component will not perform any logging.

Example (ASP):
<% Obj.LogFile = "c:\myfolder\mylogfile.csv" %>

Example (ColdFusion):
<CFSET Obj.LogFile = "c:\myfolder\mylogfile.csv">
Logging Used to specify what type of logging should be performed. Valid values are

0 component will not perform any logging, and there will be no tracked information whether mail is sent successfully or not
1 (default) only error logging will be performed, and component will log only those mails which results in some error
2 used to perform complete logging, and component will log all mails whether it is sent successfully or results in some error

Example (ASP):
<% Obj.Logging = 2 %>

Example (ColdFusion):
<CFSET Obj.Logging = 2>
Lookup This property is used, if mail sender wants to send mail without using any external or specified SMTP server. Valid values are

TRUE if this property is set as TRUE then component will send mail using reciepient's SMTP server
FALSE (default) if this property is set as FALSE then component will not send mail untill some external SMTP server is specified

Example (ASP):
<% Obj.Lookup = true %>

Example (ColdFusion):
<CFSET Obj.Lookup = true>
NameConflict This property is used for Upload or UploadAs methods to inform component how the file should be handled if its name conflicts with the name of a file that already exists in the directory while uploading. Valid values are

Error (default) if file with same name already exists in the directory then component will generate an error
Skip component will skip the file if a file with same name already exists in directory
MakeUnique component will upload file with unique name and will return its unique name for further processing
OverWrite component will overwrite file if file with same name already exists in directory

Example (ASP):
<% Obj.NameConflict = "makeunique" %>

NOTE: Can only be used for ASP.
Port This is SMTP server's port, if no port is specified then default SMTP port 25 is used for sending mail messages.

Example (ASP):
<% Obj.Port = 8025 %>

Example (ColdFusion):
<CFSET Obj.Port = 8025>
Priority Mail sender can set priority of the mail message through this property. Valid values are

Low component will send mail with low priority
Normal (default) will send mail with normal priority
High is used to send mail with high priority

Example (ASP):
<% Obj.Priority = "high" %>

Example (ColdFusion):
<CFSET Obj.Priority = "high">
Receipt This property is used, if mail sender wants to get information back, when mail receiver read the mail message. Valid values are

TRUE if this property is set as TRUE then mail sender will be informed back that the mail receiver reads the mail
FALSE (default) if it is set as FALSE then mail sender will not be informed back

Example (ASP):
<% Obj.Receipt = true %>

Example (ColdFusion):
<CFSET Obj.Receipt = true>
RecyclebinPath This property is used, if mail sender wants to place his undeliverable mail messages in his own folder. If it is not specified then default undeliverable folder is used which is already set in registry.

Example (ASP):
<% Obj.RecyclebinPath = "c:\myfolder\undeliverablefolder" %>

Example (ColdFusion):
<CFSET Obj.RecyclebinPath = "c:\myfolder\undeliverablefolder">
Server It is the SMTP server through which mail message will be sent. If it is not specified then mail message will be sent by any of the default servers which are already set in registry.

Example (ASP):
<% Obj.Server = "aspfusion.net" %>

Example (ColdFusion):
<CFSET Obj.Server = "aspfusion.net">
SetMaxFileSize This property is use for Upload or UploadAs methods to specify the maximum allowed size (in bytes) of the file to be uploaded.

Example (ASP):
<% Obj.SetMaxFileSize = 100000 %>

NOTE: Can only be used for ASP.
SpoolPath This property is used, if mail sender wants to place his mail messages in his own spool folder. If it is not specified then default spool folder is used which is already set in registry.

Example (ASP):
<% Obj.SpoolPath = "c:\myfolder\spoolfolder" %>

Example (ColdFusion):
<CFSET Obj.SpoolPath = "c:\myfolder\spoolfolder">
Subject This property is used to specify the subject of the mail message.

Example (ASP):
<% Obj.Subject = "testing mail" %>

Example (ColdFusion):
<CFSET Obj.Subject = "testing mail">
Truncate If file being uploaded using Upload or UploadAs methods exceed the maximum file size limit, then this value is used to check whether to truncate the file to maximum mentioned file size (using SetMaxFileSize property) or does not upload file. Valid values are

FALSE (default) if this property is set as FALSE then component will not upload file, if it exceed the maximum file size limit
TRUE if this property is set as TRUE then component will upload file but will truncate the file to maximum mentioned file size

Example (ASP):
<% Obj.Truncate = true %>

NOTE: Can only be used for ASP.
Type This property is used to define the mail message type. Valid values are

HTML (default) component will send mail as HTML
TEXT if it is specified as TEXT then component will send mail as plain TEXT

Example (ASP):
<% Obj.Type = "text" %>

Example (ColdFusion):
<CFSET Obj.Type = "text">

AdvSMTP Methods

Method Parameter Return Value Description
CustomHeader 1. Header Name
2. Header Value
None This method is used to set the custom headers for the mail message. This method can be called as many times as it is required.

Example (ASP):
<% Obj.CustomHeader "X-Mail-IP", "192.168.0.1" %>

Example (ColdFusion):
<CFSET Obj.CustomHeader("X-Mail-IP", "192.168.0.1")>
MimeAttach 1. File Path
2. Delete Flag
None Sets the attachment file that must be attached along with the mail message. For multiple attachment this method can be called multiple times. File Path is the complete attachment path to be attached and Delete Flag is the flag used to specify whether to delete the attachment after mail is sent. Its valid values are

Delete if this flag is set as DELETE then component will delete attachment file after mail is sent
NoDelete (default) if this flag is set as NODELETE then component will not delete attachment file after mail is sent

If this parameter is specified as empty then default value is used.

Example (ASP):
<% Obj.MimeAttach "c:\myfolder\myfile.txt", "delete" %>

Example (ColdFusion):
<CFSET Obj.MimeAttach("c:\myfolder\myfile.txt", "delete")>
MimeAttachEx 1. File Path
2. Delete Flag
None Sets the attachment file that must be attached along with the mail message. For multiple attachment this method can be called multiple times. File Path is the complete attachment path to be attached and Delete Flag is the flag used to specify whether to delete the attachment after mail is sent. Its valid values are

TRUE if this flag is set as TRUE then component will delete attachment file after mail is sent
FALSE (default) if this flag is set as FALSE then component will not delete attachment file after mail is sent

If this parameter is specified as empty then default value is used.

Example (ASP):
<% Obj.MimeAttachEx "c:\myfolder\myfile.txt", false %>

Example (ColdFusion):
<CFSET Obj.MimeAttachEx("c:\myfolder\myfile.txt", false>
SendMail 1. From Address
2. To Address
None SendMail is used to instantly send mail to the recipient(s). For multiple recipients, TO address parameter will be semicolon ";" separated list of addresses.

Example (ASP):
<% Obj.SendMail "from@aspfusion.net", "to@aspfusion.net" %>

Example (ColdFusion):
<CFSET Obj.SendMail("from@aspfusion.net", "to@aspfusion.net")>
SendQMail 1. From Address
2. To Address
None SendQMail copies the contents of the mail message in a file and places the mail request in a queue. A Service running on the server than performs the job of sending the mail message. For multiple recipients, TO address parameter will be semicolon ";" separated list of addresses.

Example (ASP):
<% Obj.SendQMail "from@aspfusion.net", "to@aspfusion.net" %>

Example (ColdFusion):
<CFSET Obj.SendQMail("from@aspfusion.net", "to@aspfusion.net")>
Upload 1. Save To Path Array of objects Upload all files to the given path.

Example (ASP):
<% set Result = Obj.Upload("c:\myfolder")
for each Member in Result
        Response.Write Member.ClientFileName
        Response.Write Member.ClientFileExtension
        Response.Write Member.ServerFileName
        Response.Write Member.ServerFileExtension
        Response.Write Member.ContentType
        Response.Write Member.FileField
        Response.Write Member.CreationTime
        Response.Write Member.LastModifiedTime
        Response.Write Member.FilePath
        Response.Write Member.FileSize
next
set Result = nothing %>

NOTE: Can only be used for ASP.

WHERE in Upload collection
ClientFileName contains name of the file uploaded from the client's system.
ClientFileExtension contains extension of the uploaded file on the client's system without a period, for example, txt not .txt.
ServerFileName contains filename of the file actually saved on the server.
ServerFileExtension contains extension of the uploaded file on the server, without a period, for example, txt not .txt.
ContentType contains MIME content type of the saved file.
FileField contains file field name.
CreationTime contains date and time when uploaded file was created.
LastModifiedTime contains date and time of the last modification to the uploaded file.
FilePath contains complete server path along with file name.
FileSize contains size of the uploaded file.

UploadAs 1. Save To Path Array of objects Upload all files to the given path with given file name.

Example (ASP):
<% set Result = Obj.UploadAs("c:\myfolder")
for each Member in Result
        if Member.FileField = "file1" then
               Member.NameConflict = "OverWrite"
               Member.SaveAs("newfilename.extension")
               if Member.IsError = 1 then
                      Member.ErrorReason
               else
                      Response.Write Member.ClientFileName
                      Response.Write Member.ClientFileExtension
                      Response.Write Member.ServerFileName
                      Response.Write Member.ServerFileExtension
                      Response.Write Member.ContentType
                      Response.Write Member.FileField
                      Response.Write Member.CreationTime
                      Response.Write Member.LastModifiedTime
                      Response.Write Member.FilePath
                      Response.Write Member.FileSize
               end if
        end if
next
set Result = nothing %>

NOTE: Can only be used for ASP.

WHERE in UploadAs collection
ClientFileName contains name of the file uploaded from the client's system.
ClientFileExtension contains extension of the uploaded file on the client's system without a period, for example, txt not .txt.
ServerFileName contains filename of the file actually saved on the server.
ServerFileExtension contains extension of the uploaded file on the server, without a period, for example, txt not .txt.
ContentType contains MIME content type of the saved file.
FileField contains file field name.
CreationTime contains date and time when uploaded file was created.
LastModifiedTime contains date and time of the last modification to the uploaded file.
FilePath contains complete server path along with file name.
FileSize contains size of the uploaded file.