| Overview |
JMail is a project very similar to CDONTS. With JMail it is possible to send email from your web page through
the web server - without having to use an email client such as Eudora,
Exchange or Outlook.
|
| Methods/Properties |
| Methods: |
- AddAttachment( FileName, [ContentType] )
- Adds a file attachment to the mssage. (When adding an attachment from your web folder, use the following path format: d:\inetpub\[yoursite.com]\[filename])
|
- AddCustomAttachment( FileName, Data )
- Adds a custom attachment. This can be used to attach "virtual files" like a generated text string or certificate etc.
|
- AddHeader( XHeader, Value )
- Adds a user defined X-header to the message
|
- AddNativeHeader( Header, Value )
- Adds a header to the message
|
- AddRecipient( Email )
- Adds a recipient to the message
|
- AddRecipientBCC( Email )
- Adds a Blind Carbon Copy recipient to the message
|
- AddRecipientCC( Email )
- Adds a Carbon Copy recipient to the message
|
- AddRecipientEx( Email, Name )
- Adds a recipient with a name to the message
|
- AddURLAttachment( bstrURL, bstrAttachAs, [bstrAuth] )
- Downloads and adds an attachment based
on an URL. A second argument, "AttachAs", is used for specifying the
filename that the attachment will receive in the message. A third and
optional argument is used for optional WWW-Authentication.
|
- AppendBodyFromFile( FileName )
- Appends body text from a file
|
- AppendText( Text )
- Append "text" to body
|
- ClearAttachments()
- Clears the list of attachments
|
- ClearCustomHeaders()
- Clears all custom headers
|
- ClearRecipients()
- Clear the recipient list
|
- Close()
- Force JMail to close a cached connection
to a mail server.
|
- Execute() : Boolean
- Executes and sends the message to the server
|
- ExtractEmailAddressesFromURL( bstrURL, [bstrAuth] )
- Downloads and adds email addresses from an URL.
|
- GetMessageBodyFromURL( bstrURL, [bstrAuth] )
- Clears the body of the message and replaces
it with the contents of the URL. The content type is automatically set
to match the content type of the URL. The second argument (login and password)
is optional
|
- LogCustomMessage( Message )
- Logs a custom user message to the JMail
log. This function works ONLY if logging is set to true
|
| Properties: |
- Body : String
- The body of the message. To append text to the body use AppendText
|
- Charset : String
- This is the charset of the message. The default is "US-ASCII"
|
- ContentTransferEncoding : String
- Specifies the content transfer encoding. The default is "Quoted-Printable"
|
- ContentType : String
- This is the content type of the message. It defaults to "text/plain" but can be set to whatever you need. If you want to send HTML in your messages, change this to "text/html"
|
- DeferredDelivery : Date
- Sets deferred delivery of messages. If the mailserver supports it, the message won't be delivered before this date and time.
|
- Encoding : String
- This can be used to change the default Attachment encoding from base64. Valid options are "base64", "uuencode" or "quoted-printable"
|
- ErrorCode : Integer
- Contains the error code if JMail.silent is set to true
|
- ErrorMessage : String
- Contains the error message if JMail.silent is set to true
|
- ErrorSource : String
- Contains the error source if JMail.silent is set to true
|
- ISOEncodeHeaders : Boolean
- Encodes header stings according to iso-8859-1 character sets. The default is true.
|
- Lazysend : Boolean
- This property specifies if JMail is to wait until the mail is sent and then return or if it is to buffer the message and send it in the background. By setting this, however, you do not get control of error messages etc.
NOTE: If you use this option, ServerAddress has NO function.
The lazysend function will resolve the Mail server with DNS queries.
This can be a problem in some configurations.
|
- Log : String
- This is the log created by JMail when
logging is set to true
|
- Logging : Boolean
- Enables/Disables logging in JMail
|
- MailDomain : String
- This can be used to override the EHLO/HELO
statement to your mail server
|
- MimeVersion : String
- Specifies the mime version. The default is "1.0"
|
- Priority : Integer
- This is the priority of the message. The range of priorities can be from 1 to 5.
- This means that the message is High Priority. Some mailers prefer to call this level "Urgent".
- This is also high priority.
- This is normal priority.
- This is low priority.
- This is the lowest priority.
|
- Recipients : String
- Read-only property of all recipients of
this message
|
- ReplyTo : String
- Specifies an optional reply address
|
- ReturnReceipt : Boolean
- Specifies whether or not the sender requires a return receipt. The default value of the property is "false"
|
- Sender : String
- Specifies the sender address of the message
|
- SenderName : String
- Specifies the sender name of the message
|
- ServerAddress : String
- Specifies the address of the server. There can be more than one server specified by separating the list with a semicolon. If a port other than 25 is used, specify this by adding a colon after the servername. If the serverAddress is left blank, JMail will try to resolve the remote mail server and send the message directly to that server.
|
- Silent : Boolean
- Set to true, JMail will not trow exceptions. Instead JMail.execute() will return true or false depending on the success of the operation
|
- SimpleLayout : Boolean
- Set to true to reduce the number of headers JMail produces.
|
- Subject : String
- Specifies the subject of the message
|
- UsePipelining : Boolean
- Overrides if JMail should use pipelining on a server that supports it.
|
| Example |
Set JMail = Server.CreateObject("JMail.SMTPMail")
' This is my local SMTP server
JMail.ServerAddress = "mailrelay.terrasite.com"
' This is me....
JMail.Sender = "myemail@mydomain.net"
JMail.Subject = "Here you go..."
' Get the recipients mailbox from a form (note the lack of a equal sign).
JMail.AddRecipient "mum@any.com"
JMail.AddRecipient "dad@some.com"
' The body property is both read and write.
' If you want to append text to the body you can
' use JMail.Body = JMail.Body & "Hello world!"
' or you can use JMail.AppendText "Hello World!"
' which in many cases is easier to use.
JMail.Body = "Here you go. The program is attached to this message"
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
' Send it...
JMail.Execute
|