Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

Chili!Mail (SMTP) Component

The Chili!Mail component enables users to send e-mail messages from an ASP page to an SMTP e-mail server. The Chili!Mail component is compatible with the NewMail object included with the Microsoft Internet Information Services (IIS) CDONTS component. However, the Chili!Mail component does not support the following properties and methods of the NewMail object:

·   AttachURL

·   ContentBase

·   ContentLocation

·   MailFormat

·   SetLocaleIDs

·   Version

Other differences between the Microsoft NewMail object and the Chili!Mail component are described in the property and method descriptions that follow.

Chili!Mail Registry Settings

The Chili!Mail component does not use registry settings.

Chili!Mail Syntax

The Chili!Mail component is registered with the ProgId of "CDONTS.NewMail".

The following ASP script written in VBScript creates an instance of the component:

Set mailer = Server.CreateObject("CDONTS.NewMail")

Chili!Mail Properties

The Chili!Mail component exposes the following properties:

·   Bcc

·   Body

·   BodyFormat

·   Cc

·   From

·   Host

·   Importance

·   Retain

·   Subject

·   To

·   Value

·   WrapLength

Chili!Mail Bcc Property (String: Read/Write)

The Bcc property specifies one or more recipients of a blind copy of the message. A full messaging address must be provided for each recipient, as shown in the following example:

"useraddress@company.com"

Addresses must be separated by a semicolon (;), as shown in the following example:

"user1@company1.com;user2@company2.com;user3@company3.com"

Chili!Mail Body Property (String: Read/Write)

The Body property is a string that specifies the content of the message. Line breaks should be sent as carriage return-linefeed pairs, for example, "Chr(13) & Chr(10)".

Chili!Mail BodyFormat Property (Long: Write only)

The BodyFormat property specifies the message format available for the Chili!Mail Body property. The values for the BodyFormat property can be set as follows:

·   0 indicates that the Body property can include HTML

·   1 indicates that the Body property can include plain text only (default)

Chili!Mail Cc Property (String: Read/Write)

The Cc property specifies one or more recipients of a copy of the message. A full messaging address must be provided for each recipient, as shown in the following example:

"useraddress@company.com"  

Addresses must be separated by a semicolon (;), as shown in the following example:

"user1@company1.com;user2@company2.com;user3@company3.com"  

Chili!Mail From Property (String: Read/Write)

The From property is a string that specifies the content of the From field of the message header. It cannot include spaces.

Note

The From field cannot exceed 255 characters, the limit for a single e-mail address. There is no character limit for the To, Cc, and Bcc fields.

Chili!Mail Host Property (String: Read/Write)

The Host property is a string that specifies the valid DNS name (for example, "mail.myorg.com") or IP address of the SMTP mail server. The default is "localhost".

Chili!Mail Importance Property (Long: Read/Write)

The Importance property specifies the importance of the message to be sent. Valid values are:

·   0 indicates low importance

·   1 indicates normal importance

·   2 indicates high importance

Chili!Mail Retain Property (BOOLEAN: Read/Write)

The Retain property specifies whether message properties are retained after the Send method is called. If set to True, all properties are retained. If set to False (the default), all properties are cleared.

Chili!Mail Subject Property (String: Read/Write)

The Subject property is a string that specifies the content of the subject line of the message. This property may be left empty.

Chili!Mail To Property (String: Read/Write)

The To property specifies one or more message recipients. A full messaging address must be provided for each recipient, as shown in the following example:

"useraddress@company.com"  

Addresses must be separated by a semicolon (;), as shown in the following example:

"user1@company1.com;user2@company2.com;user3@company3.com"  

If both the To property and the To parameter of the Send method are supplied, the message is sent to all recipients in both lists.

Chili!Mail Value Property (Read/Write)

The Value property adds one or more headers to the automatically generated headers, such as To, From, Subject, and Date. Possibilities for additional headers include File, Keywords, and Reference.

Certain headers, such as Reply-To, are widely accepted and used by various messaging systems. For such a header to be recognized by recipients, the character string in the header name must exactly match the accepted string.

In principle, you can put any combination of ASCII characters in the string, but some messaging systems might restrict the character set. The safest procedure is to limit the string to alphanumeric characters, dashes, and slashes, and in particular to avoid spaces.

You can set the Value property more than once. Each setting generates another header to be included with the existing headers.

Chili!Mail WrapLength (Read/Write)

The WrapLength property applies to message content. It specifies the maximum number of characters allowed in a line before the line wraps; in other words, before it breaks and continues on the next line. The line breaks at the last space before the specified maximum number of characters has been reached. The default setting is 76. The maximum is 1,000.

Chili!Mail Methods

The Chili!Mail component provides the following methods:

·   AttachFile  

·   Send

Chili!Mail AttachFile Method

The AttachFile method attaches a file to the message. Messages are multi-part mime encoded, and attachments follow the text portion of the message.

Source

A string containing the absolute path name of the file to attach.

CDONTS Note

All messages are Base64 encoded. There is no provision for specifying a different encoding method.

Chili!Mail Send Method

The Send method sends the message using the properties previously set. All arguments to this method are optional and override the properties previously set for the message (except for the To argument, which is combined with any previously set To property).

Calling the Send method resets all message properties in preparation for the next message, unless the Retain property is set to True. Multiple messages can be sent using the same instance of the Chili!Mail component.

Chili!Mail Send Method Arguments

From

See the description of the property of the same name above.

To

See the description of the property of the same name above.

Subject

See the description of the property of the same name above.

Body

See the description of the property of the same name above.

Importance

See the description of the property of the same name above.

Host

See the description of the property of the same name above.

Chili!Mail Send Method Examples

Example 1:

Set mailmsg = Server.CreateObject("CDONTS.NewMail")

mailmsg.To = "youraccount@yourco.com"

mailmsg.From = "MailTest"

mailmsg.Body = "This is a test message." & Chr(13) & Chr(10) & "This is the second line."

mailmsg.Host = "mail.yourco.com" 

mailmsg.Send

Example 2:

Set mailmsg = Server.CreateObject("CDONTS.NewMail")

Message = "This is a test message." & Chr(13) & Chr(10) & "This is the second line."

mailmsg.Send "myaccount@yourco.com", "youraccount@yourco.com", "Test Subject", Message, 2, "mail.yourco.com"

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.