If you feel some confusion about any thing or if you do not find what you are looking for, please inform us so that we can improve our documentation accordingly. docs@aspfusion.net

AdvSMTP

The component allows you to send mail messages through any SMTP server provided according to standard SMTP protocol. Access to the component can also be turned on at website basis like all other ASPFusion components. AdvSMTP is much more advanced component for sending mail messages. The component provide following operations.

  1. CC and BCC.

  2. Multiple attachments.

  3. Embedded images (a new feature provided by the component).

  4. Chinese and other languages support and many other features like this.

  5. Along with these basic operations, it provides Upload and UploadAs facility. 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, its values are 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 all to provide browser based File Upload on your server.

The component send mails in two ways.

  1. Blocking, in which ASP page wait for the response from the component.

  2. Non Blocking, in which component returns control back to ASP page and trigger a service, which is then responsible for sending the mail. The service also logs all information of sent mails.

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

AdvSMTP Properties 

Property

Description

BCC

Contains the address to whom, the blind carbon copy should be sent. For multiple recipients, addresses will be semicolon (;) separated.
Example:
<%Obj.BCC = “info@aspfusion.net; support@aspfusion.net”%>

Body

The property is to assign the body of the mail. For a long body one can call it multiple times. Embedded images can also be sent within the body using a specified tag i.e.
<AdvImageMail: c:\test\bubbles.bmp|0>. Whereas the ‘0’ specifies that do not delete the file after the mail is sent. A ‘1’ here tells the component to delete the file after the mail is sent.
Example:
<%Body = "Testing Mail message"
Obj.Body = Body%>

CC

Contains the address to whom, the carbon copy of the mail should be sent. For multiple recipients, addresses will be semicolon (;) separated.
Example:
<%Obj.CC = "info@aspfusion.net; support@aspfusion.net”%>

Count

Return number of files to be uploaded
Example:
<%Response.Write Obj.Count”%>

ErrorReason

Reports any errors that occur during the request
Example:
<%if Obj.IsError = 1 then
        Response.Write Obj.ErrorReason
else
        No Error
end if %>

Form

Return form fields values
Example:
<%Response.Write Obj.Form("Submit")%>

IsDefined

Check whether a form field exists or not. Return 1 if it exist otherwise 0
Example:
<%if Obj.IsDefined("Submit")  then
         Defined
else
         Not Defined 
end if%>

IsError

Returns 1 if any error occur during the request otherwise 0
Example:
<%if Obj.IsError = 1 then
        Error
else
        No Error
end if %>

LogFile

By default the logging is performed in a file AdvMail.log on the server present in a specific directory. If the user wants the logging to be performed in user defined path then he can specify his own path for logging. 
Example:
<%Obj.LogFile = “C:\MyLogFile.log”%>

Logging

Used to specifying what type of logging should be performed. Valid values are
0 No Logging
1 Error Logging (default)
2 Complete logging
Example:
<%Obj.Logging = 2%>

NameConflict

Determines how the file should be handled if its name conflicts with the name of a file that already exists in the directory. Valid values are
Error (default)
Skip
MakeUnique
OverWrite
Example:
<%Obj.NameConflict = "MakeUnique"%>

Port

It is the port by which the mail should be sent if no port is specified then a port 25 is used for sending the mails.
Example:
<%Obj.Port = 8025%>

Receipt It is used, if mail sender wants to get information back, when mail receiver reads the mail message. If this value is set TRUE, then mail sender will get information that the mail receiver reads the mail, otherwise mail sender will not be informed.
Valid values are
TRUE
FALSE (default)
Example:
<%Obj.Receipt = true%>  

Server

It is the SMTP server through which the mail will be sent. If it is not specified then the mail will be sent by any of the default servers.
Example:
<%Obj.Server = “aspfusion.net”%>

SetMaxFileSize

Specified the maximum allowed size of the files to be uploaded
Example:

<%Obj.SetMaxFileSize
= 100000%>

Subject

It is the subject of the mail.
Example:
<%Obj.Subject = "Mail Subject"%>

Truncate

If this property is set to TRUE and size of the file being uploaded exceed the maximum file size, then file is truncated to maximum file size mentioned. If it is FALSE then file is not uploaded if file size exceed the limit. Valid values are
FALSE (default)
TRUE
Example:
<%Obj.Truncate = true%>

Type

It defines the mail type. Valid values are
HTML (default)
TEXT
Example:
<%Obj.Type = “TEXT”%>

AdvSMTP Methods 

Method

Parameter

Return Value

Description

CustomHeader ID
Value
None Set custom header in mail. The ID parameter is ID for custom header and Value parameter is to specify its value.
Example:
<%Obj.CustomHeader ID, Value%>  

MimeAttach

FileName
DelFlag

None

Sets the attachment file that must be sent along with the mail. For multiple files the method can be called multiple times. FileName has the path of the attachment file and DelFlag to specify whether to delete the file after sending mail. Valid values are
Delete
(default)  
NoDelete
If this value is not specified then default value is used. 
Example:

<%Obj.MimeAttach FileName, ""%>
<%Obj.MimeAttach FileName, "NoDelete"%>

SendMail

To
From

None

SendMail is used to instantly send the mail to the recipients. In the parameter “To” the recipient’s address is specified. For multiple recipients “To” will be semicolon (;) delimited addresses.
Example:
<%Obj.SendMail From, To%>

SendQMail

To  
From

None

SendQMail copies the contents of the mail in a file and places the mail request in a Queue. An NT Service running on the Server then performs the job of sending the mail. “To” specifies the recipients’ mailing address. For multiple recipients “To” will be a semicolon delimited string of recipients addresses.
Example:
<%Obj.SendMail From, To%>

Upload SaveTo Array of objects Upload all files to the given path
Example:
<%set Upload = Obj.Upload(SaveTo)
for each Member in Upload
      =Member.ClientFileName
      =Member.ClientFileExtension
      =Member.ServerFileName
      =Member.ServerFileExtension
      =Member.ContentType
      =Member.FileField
      =Member.CreationTime
      =Member.LastModifiedTime
      =Member.FilePath
      =Member.FileSize
next
set Upload = nothing%>  
UploadAs SaveTo   Array of objects Upload files to the given path with given filename
Example:
<%set Upload = Obj.UploadAs(SaveTo)
for each Member in Upload
      if (Member.FileField = "File1") then
          Member.NameConflict = " OverWrite"
          Member.SaveAs(Name.extension)
          if (Member.IsError = 1) then
              Member.ErrorReason
          else
              =Member.ClientFileName
              =Member.ClientFileExtension
              =Member.ServerFileName
              =Member.ServerFileExtension
              =Member.ContentType
              =Member.FileField
              =Member.CreationTime
              =Member.LastModifiedTime
              =Member.FilePath
              =Member.FileSize
          end if
      end if
next
set Upload = nothing%>

Back 

Copyright © 2000, Advanced Communications