Mail Classes

This chapter provides an overview of PeopleSoft MultiChannel Framework mail classes and discusses how to:

Click to jump to parent topicUnderstanding PeopleSoft MultiChannel Framework Mail Classes

This section discusses:

Click to jump to top of pageClick to jump to parent topicPeopleSoft MultiChannel Framework Mail Classes

The PT_MCF_MAIL application package contains the following classes:

Use the mail classes to develop applications to create and send emails, fetch and delete emails on the mail server, manage emails in your PeopleSoft database, and access attachments . By using the mail classes, you are not required to know the details of the GETMAILTARGET connector or the database schema.

Click to jump to top of pageClick to jump to parent topicScope of the Mail Classes

The mail classes can be instantiated only from PeopleCode.

The mail classes can be called from a component, an internet script, or a Application Engine program.

Mail classes can be of local, global, or component scope.

Click to jump to top of pageClick to jump to parent topicData Types of the Mail Classes

Every mail class is its own data type; that is, get mail objects are declared as data type MCFGetMail, store mail objects are declared as type MCFMailStore, and so on.

The following are the data types of the mail classes:

Click to jump to parent topicImporting Mail Classes

The mail classes are not built-in classes, like Rowset, Field, Record, and so on. They are application classes. Before you can use these classes in your PeopleCode program, you must import them to your program.

An import statement names either all the classes in a package or a particular application class.

The application package PT_MCF_MAIL contains the following classes:

To import all the mail classes, use the following import statement:

import PT_MCF_MAIL:*;

Using an asterisk after the package name makes all the application classes directly contained in the named package available. Application classes contained in subpackages of the named package are not made available. The PT_MCF_MAIL application package contains no subpackages.

See Also

Application Classes

Click to jump to parent topicCreating a Mail Object

After you've imported the mail classes, you instantiate an object of one of those classes using the constructor for the class and the Create function.

The following example creates a new instance of the MCFGetMail class, as the variable &gm, with local scope:

Local MCFGetMail &gm = create MCFGetMail();

Click to jump to parent topicUsing the Mail Classes

This section discusses how to use the mail classes, and includes the following:

Click to jump to top of pageClick to jump to parent topicGeneral Lifecycle of an Outbound Email

The following are the general steps used to create an outbound email:

  1. Create an MCFOutboundEmail object

  2. Set the usual properties for an email, such as the From, Subject, Recipients, and Text properties.

  3. If necessary, set the parts of the email using MCFMultipart and MCFBodyPart classes.

  4. Use the Send method to send the email.

The MCFPart and MCFEmail classes provide the common functionality for the MCFBodyPart and MCFOutboundEmail (and MCFInboundEmail) classes, respectively. In general, you never need to use the MCFPart or MCFEmail classes directly in your PeopleCode programs. However, in rare cases you may use these classes if you want to extend the application package.

The SMTPSession class encapsulates all the session parameters that can be set in a Simple Mail Transfer Protocol (SMTP) session. Each MCFOutboundEmail object points to one SMTPSession object. In most cases, the parameters for the SMTP session are set from values found in the application server configuration file (psappsrv.cfg). However, you can also set these parameters by creating an SMTPSession object, setting the desired parameters, then creating an MCFOutboundEmail object.

For convenience, all SMTP attributes are also directly accessible from the MCFOutboundEmail class, so you don't need to create an SMTPSession object when you're sending just one email.

When you want to send many emails in a single SMTP session, you don't have to set the SMTP session parameter in each and every email. For this case, you can create a single SMTPSession, using either the default settings or explicitly setting the desired parameters, then use the CreateOutboundEmail method of SMTPSession object to create all the MCFOutboundEmail objects. This way all the MCFOutboundEmail objects use the same SMTP session parameters. After specifying the value of all the parameters for all the MCFOutboundEmail objects, use the SendAll method of SMTPSession object to send all the emails in one SMTP session.

All the application classes mentioned above hold all the data until one of the Send methods is called. The Send methods connect to the mail server using a JavaMail API that sends the mail.

Since all communication to the mail server happens when a Send method is called, errors are only reported when the Send method returns. The return value indicates the success or the failure of the send process. In case of failure, you can query the MCFOutboundEmail application class for the details of the error. The error details are available in properties such as MessageSetNumber, MessageNumber, ErrorDescription, ErrorDetails, and so on.

Click to jump to top of pageClick to jump to parent topicDelivery Status Notification and Return Receipts

There is an SMTP extension that supports Delivery Status Notifications (DSN) defined in RFC 1891. This may or may not be supported by the user's Mail Transport Agent (MTA). The acknowledgements do not indicate whether the user reads the message, they only acknowledge receipt of the message by their mail server. It is possible that the mail server throws the message away as spam and the end user never actually receives the email. To get such notifications, set the StatusNotifyOptions and StatusNotifyReturn properties, as in the following example:

&email.StatusNotifyOptions = "SUCCESS,FAILURE"; &email.StatusNotifyReturn = "HDRS";

You can use the IsReturnReceiptReqd property to specify if a return receipt should be sent when the mail server receives and opens the email. This property only works if the underlying SMTP server supports this feature. The following is an example of using this property:

&email.IsReturnReceiptReqd = True;

Click to jump to top of pageClick to jump to parent topicPriority

There is no SMTP standard for message priority. Most email applications use an X−Priority value of 3 for messages with "normal" priority. More important messages have lower values and less important messages have higher values. In most cases, urgent messages have an X−Priority value of 1. The priority code used with the Mail classes, and set in the headers are as follows:

  1. Highest Priority

  2. High Priority

  3. Normal

  4. Low Priority

  5. Lowest Priority

The default value is 3, that is, normal priority.

Different email programs render these different values in a variety of ways, usually using some kind of colored symbols or arrows.

Set the priority for an email using the Priority property. The following is an example:

&Email.Priority = 2;

Click to jump to top of pageClick to jump to parent topicMCFBodyPart and MCFEmail Considerations

Both MCFBodyPart and MCFEmail objects are used for both inbound and outbound email. The following sections specify which methods and properties are generally used for inbound, and which are used for outbound, for the different objects.

Inbound and Outbound MCFBodyPart Class Methods

All of the methods except the GetUnparsedHeaders method for the MCFBodyPart class are used with outbound email. The following methods are generally used with inbound email as well:

Inbound and Outbound MCFBodyPart Class Properties

The following properties are primarily used with inbound email. Note that some of these properties are also used with outbound email.

The following properties are primarily used with outbound email. Note that some of these properties are used with inbound email as well.

Inbound and Outbound MCFEmail Class Properties

The following properties are used with inbound email. Note that most of these properties are also used with outbound email.

The following properties are used with outbound email. Note that many of these properties are also used with inbound email.

See Also

MCFBodyPart Class Methods

MCFBodyPart Class Properties

MCFEmail Class Properties

Click to jump to parent topicRetrieving Email From a Mail Server With the MCFGetMail Class

Use the MCFGetMail class to retrieve email from your mail server and load it in a rowset. After you have decided that an email needs to be saved to the PeopleSoft database, use MCFMailStore class.

This section covers the following topics:

Click to jump to top of pageClick to jump to parent topicStructure of Rowset Used for Email Information

The following list describes the different levels of the rowset that contains email information, and what each level contains.

Level 0

The first row at level zero is empty except for the number of rows contained within level zero and return status. The first row contains the return status for the entire batch of emails. Apart from the return status of the whole batch, each individual row has its own EMAIL_RET_STATUS. When a fatal error occurs, such as a connector size overflow, an IB overflow, or an error accessing attachments , the return status is copied to the first row. Subtle errors like unsupported encoding for a part of a individual email appear in the return status of that email only. Each row after the first row contains information about an individual email, such as the header information, the time received, and so on.

Level 1

Level one is where the parts of an email reside. The level one child rowsets are linked to the parent rowset in level zero by the MCF_EMAIL_ID, a unique ID assigned by PeopleSoft.

Note. Multipurpose Internet Mail Extensions (MIME) is an Internet standard for representing multipart and multimedia data in email. It enables email to be exchanged between different email systems. The parts may be nested. PeopleSoft embeds the JavaMail API to implement support for the MIME standard. However, all parts of an email are represented in PeopleSoft as level one rowsets, regardless of the hierarchy that existed in the original email.

The following table describes the fields within the rowset at level zero.

Field

Description

MCF_ATTACH_LIST

Contains a list of all the file names that are attachments for a particular email.

Multiple items are separated by a semicolon (;).

MCF_IS_ATT_URL

This is a Boolean value indicating whether the email body is located in the MCF_EMAIL_TEXT or in the attachment directory.

If this value is 1 (true), the email body is located in the attachment directory and can be accessed using the MCF_ATT_URL value.

If this value is 0 (false), then the email body is located in MCF_EMAIL_TEXT.

MCF_ATT_URL

This URL enables you to view an attachment. This URL is viewable only if the corresponding email has been authorized for the current user.

This value is a relative URL. The URL becomes fully qualified only after the rowset has been saved to the PeopleSoft database and then later retrieved using the MCFMailStore class.

The following is a sample URL: http://sundance.peoplesoft.com/PSAttachServlet/ps/mcfdev1/39297_31030554591_1.gif?contentType=image/gif

mcfdev1 is the mail user name.

39297__31030554591_1.gif is the file name in the attachment directory.

contentType is used by the browser to open a viewer associated with this type.

The filename of the downloaded attachment is constructed by using the email's unique ID and the part number.

Warning! Downloading the same emails twice from the mail server overwrites the associated files in the directory. If the same email is stored twice in the PeopleSoft database, the system creates two separate rows. If you delete either one of these rows, the system deletes the associated files in the directory. To avoid this situation, delete emails from the mail server after you have retrieved them.

See AuthorizeEmailAttach.

MCF_IBNODE_NAME

Identifies the name of the Integration Broker node that received the email, such as MCF_GetMail.

The system uses this value to construct the fully qualified URL required for viewing attachments.

MCF_ATTACH_SIZES

Indicates the size of the attachments associated with an email.

Multiple values are separated by a semicolon (;).

The attachment sizes appear in the same order as the file names in MCF_ATTACH_LIST.

MCF_EMAIL_FROM

Indicates the email account that sent the email, such as jsmith@company.com.

MCF_DTTM_RECV

Indicates the time that the mail server received the email.

Warning! If you are using a Post Office Protocol 3 (POP3) mail server, this field may not be populated.

MCF_OFFSET_RECV

Indicates the time zone of the mail server that received this email.

Note. This field contains the time zone of the integration gateway used to fetch this email.

MCF_DTTM_SENT

Indicates the time that the email was sent.

MCF_OFFSET_SENT

Indicates the time zone of the mail server that sent this email.

Note. Currently, this field contains the time zone of the integration gateway used to fetch this email.

MCF_DTTM_SAVED

Records the date and time that the PeopleSoft system saved an email to the PeopleSoft database.

If you use a POP3 mail server, PeopleSoft recommends using this value as the base, or starting point, for any time-sensitive transactions.

MCF_EMAIL_SENDER

This is the reply to address. This supports a mail feature in which users can send an email from one account, but when the receiver chooses to reply, the system addresses the email to a different account. For instance, sales representatives may send an email from their personal email account, as in tom_sawyer@company.com, but when customers reply, the email is addressed to sales@company.com.

MCF_EMAIL_TEXT

Represents the text that was delivered in the body of the email.

Before the email is downloaded, this field contains the body of the email. After the email has been downloaded, this field is blank.

Check the MCF_IS_ATT_URL value to determine whether your email text resides in this field or the attachment directory.

PeopleSoft relies on the originating email client embedding encoding information to determine character set. For example, Content-type: text/plain; charset=Big5

MCF_NOTIFY_CC

Indicates the parties who were copied (carbon copied) on the email. Multiple addresses are separated by a semicolon (;).

MCF_NOTIFY_TO

Indicates the parties who received the email. Multiple addresses are separated by a semicolon (;).

MCF_UID_LIST

This contains a unique identifier created by POP3 or an IMAP4 mail server. It is guaranteed to be unique within a particular mail box.

Note. The DeleteEmail method also uses this value when deleting a list of emails. When deleting emails, this field can contain multiple values separated by a space.

MCF_WL_SUBJECT

Contains the subject of the email. A maximum of 254 characters is allowed.

PeopleSoft relies on the originating email client embedding encoding information to determine character set.

For example:

Email Subject: Subject: =⇒ ?Big5?B?uvuqwLBPqsy67qZYs/i+yS+kp⇒ LDqqXik6Ldztdg=?= =?Big5?B?uvSlSKTOp⇒ Eilwbr0MzCk6bVvqu2q+KTloUGkaqRP?==⇒ ?Big5?B?scCxUqa/v0GlwQ==?=

where ?Big5? is the prefixed encoding information.

MCF_RET_STATUS

Represents where the system stores the return status of a particular mail class method.

MCF_EMAIL_STATUS

This field is not currently used.

MCF_NUMROWS

Indicates the number of rows (level one child rowsets) that contain parts of a particular email. For example, if an email has two child rowsets associated with it at level one, this value would be 2.

Note. For row one of the level zero rowset, this field reflects the number of emails in this rowset. If you fetch 10 emails, the rowset contains 11 rows, but the MCF_NUMROWS value in row 1 equals 10. Row 1 of the level zero rowset never contains an email.

MCF_EMAIL_MSG_ID

This is the globally unique identifier for this email. This ID is generated by the mail server that sent this email.

MCF_REPY_TO

This is the reply to field.

MCF_REF_IDS

Use this field for the reference header fields of the message.

MCF_REPLY_IDS

This value contains the email address that the email can reply to.

MCF_MSG_SIZE

Represents the total size of the entire email. This value includes the sizes of attachments.

MCF_EMAIL_LANG_CD

This value reflects the language code of the Integration Broker node that received this email.

Note. PeopleSoft recommends setting up email accounts that are dedicated to one language such as, support_french@company.com and support_english@company.com. This enables you to anticipate the language of the email you read into your system. In turn, configure separate Integration Broker nodes to handle each of the languages you support. There are no language recognition procedures within the PeopleSoft system.

MCF_USER

Represents the user account (mail box) on the mail server that received the email.

MCF_SERVER

Represents the mail server that received the email.

MCF_ERROR_COUNT

Used to return the number of messages that caused errors during processing on the target connector.

MCF_QUARANTINE_COUNT

Used to return the number of messages that caused errors during processing on the target connector and were successfully moved to the quarantine folder (This value is always 0 for POP3).

MCF_CONTENT_TYPE

This is the content type of the email itself. For example, a content type could be text/plain, text/html, or multipart/alternative.

MCF_EMAIL_HEADERS

This field is used to return the email message headers. It contains the raw headers in RFC 822 format. The MCFHeaders class can be used to parse the contents of this field.

The following table describes the fields within the rowset at level one. This rowset contains the parts of the email.

Field

Description

MCF_ATT_URL

This is the URL of an associated attachment in the attachment directory.

This URL is a relative value when this rowset is first received from the mail server and stored in the database. It only becomes a fully qualified URL once you retrieve the rowset using the MCFMailStore class.

Keeping the URL a relative value enables you to make changes within the system without breaking the URL.

MCF_IS_ATT_URL

This is a Boolean value indicating whether the email part is located in the MCF_EMAIL_TEXT or on the attachment directory.

If this value is 1 (true), the email part can be accessed using the MCF_ATT_URL value.

If this value is 0 (false), then the email part is located in MCF_EMAIL_TEXT.

MCF_FILENAME

Represents the file name for an attachment, such as revenue.xls or resume.doc. The file name can be used as a read-only label on the page used by end users to view attachments. For example, the file name may appear next to the link that opens the attachment.

Note. Not all parts have file names.

MCF_FILE_DATA

This field is not currently used.

MCF_EMAIL_HEADERS

This field is used to return the email part headers. It contains the raw headers in RFC 822 format. The MCFHeaders class can be used to parse the contents of this field.

MCF_EMAIL_TEXT

Contains the text content of the email part.

Note. Although the same rowset structure is used for retrieving email from the mail server and for retrieving email from the PeopleSoft database, not all of the fields apply to each situation. For example, when you first retrieve email from the mail server, the rowset does not contain the fully qualified URL to any attachments.

Note. After an email is saved to the database, always use the methods in the MailStore application package class to access the email. Do not read directly from the mail tables.

Click to jump to top of pageClick to jump to parent topicError Messages Returned by MCFGetMail Class Methods

The GetMail Integration Broker connector returns message codes denoting status. These return codes apply to all the methods within the MCFGetMail class. The following are returned in MCF_RET_STATUS field, and by the Status property.

0

Success.

1

Connector size overflow.

The size of the email requested exceeds the value in MCF_EmSz_Conn.

The system returns the header information for this email with the return status set to 1.

See Configuring GETMAILTARGET Properties.

2

Integration Broker threshold size overflow.

The size of the email requested exceeds the value in MCF_EmSz_IB.

This happens when the size of the XML message constructed to transfer emails from the mail server to the database exceeds the threshold value.

If there are any more emails to be processed in the current batch, the system does not fetch them from the mail server. For example, suppose your program fetches 20 emails at a time from the mail server, and this error occurred on the tenth email. In this case, the system processes the tenth email, but emails 11–20 are still be on the mail server.

See Configuring GETMAILTARGET Properties.

3

Cannot delete all the messages from the mail server.

4

Connecting to the mail server failed.

5

The attachments to be deleted were not found.

6

At least one attachment cannot be deleted.

7

Unsupported encoding.

8

Cannot write to the attachment directory.

9

Messages were downloaded to directory and deleted from mail server.

This status code occurs when an exception occurs in Integration Broker while storing the emails to the database. The exception might occur due to invalid characters in the email. If the email is left on the mail server, the same exception will occur repeatedly, preventing you from fetching further emails. Because the header might contain these invalid characters also, only MCF_RET_STATUS, MCF_MSG_SIZE, MCF_UID_LIST, date time fields, MCF_IS_ATT_URL, MCF_ATT_URL are set. There is no way to determine which email caused the exception, so the system writes all the emails to the directory. All the emails in the batch are deleted from the mail server.

 

10

Email content error. One example of this is unsupported encoding.

 

11

Returned if attempting to create a mail server folder while using the POP3 protocol.

12

Folder creation on mail server failed.

13

GetMail connector internal error.

See Status.

Click to jump to parent topicMail Classes Constructors

The following section provides examples of the mail class constructors.

Click to jump to top of pageClick to jump to parent topicMCFBodyPart

Example

Local PT_MCF_MAIL:MCFBodyPart &text = create PT_MCF_MAIL:MCFBodyPart();

Click to jump to top of pageClick to jump to parent topicMCFGetMail

Example

Local MCFGetMail &gm = create MCFGetMail();

Click to jump to top of pageClick to jump to parent topicMCFOutboundEmail

Example

Local PT_MCF_MAIL:MCFOutboundEmail &eMail = create PT_MCF_MAIL:MCFOutboundEmail(); `

Click to jump to top of pageClick to jump to parent topicMCFMailStore

Example

Local MCFGetMail &sm = create MCFMailStore();

Click to jump to top of pageClick to jump to parent topicSMTPSession

Example

Local PT_MCF_MAIL:SMTPSession &commonSession = create PT_MCF_MAIL:SMTPSession();

Click to jump to parent topicMCFBodyPart Class

Use the MCFBodyPart class to send email with attachments, HTML, or other non-standard text information.

Click to jump to parent topicMCFBodyPart Class Methods

In the following, we discuss the MCFBodyPart class methods. The methods are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicAddHeader

Syntax

AddHeader(HeaderName, HeaderValue)

Description

Use the AddHeader method to add a header to the body part. This method allows for email server customizations. Some commonly used headers are already exposed as properties, such as ContentType and ContentLanguage. Advanced applications can adapt this technique to meet their own requirements. These headers can be either standard SMTP headers or custom headers starting with "X-".

Parameters

HeaderName

Specify the name of the header that you want to add. This parameter takes a string value.

HeaderValue

Specify the actual text of the header, as a string.

Returns

None.

Example

Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail⇒ (); Local string &TestName = "Custom Header"; &email.From = &def.From; &email.Recipients = &def.Recipients; &email.SMTPServer = &def.SMTPServer; &email.Subject = &TestName; &email.Text = &TestName; &email.AddHeader("X-Mailer", "CRM Sales Application 8.9 SP2"); &email.AddHeader("X-Mailer", "CRM Sales Application 8.9 SP3"); &email.AddHeader("X-Mailer", "CRM Sales Application 8.9 SP4"); &res = &email.Send();

See Also

MCFBodyPart class: GetHeader method, GetHeaderCount method, GetHeaderName method, GetHeaderNames method, GetHeaderValues method, GetUnparsedHeaders method.

Click to jump to top of pageClick to jump to parent topicGetHeader

Syntax

GetHeader(HeaderName)

Description

Use the GetHeader method to return the value of the specified header.

This method is primarily used with inbound email messages.

Parameters

HeaderName

Specify the name of the header that you want to access the values for, as a string.

The matching of header names is case insensitive.

Returns

An array of string containing the header values. If the header is not present, returns an array of length zero.

See Also

MCFBodyPart class: AddHeader method, GetHeaderCount method, GetHeaderName method, GetHeaderNames method, GetHeaderValues method, GetUnparsedHeaders method.

Array Class

Click to jump to top of pageClick to jump to parent topicGetHeaderCount

Syntax

GetHeaderCount()

Description

Use the GetHeaderCount method to return the number of headers.

Parameters

None.

Returns

An integer, representing the number of headers present.

See Also

MCFBodyPart class: AddHeader method, GetHeader method, GetHeaderName method, GetHeaderNames method, GetHeaderValues method, GetUnparsedHeaders method.

Click to jump to top of pageClick to jump to parent topicGetHeaderName

Syntax

GetHeaderName(Index)

Description

Use the GetHeaderName to return the name of the header that is located at Index.

Parameters

Index

Specify the numeric position of the header you want to access.

Returns

A string.

See Also

MCFBodyPart class: AddHeader method, GetHeader method, GetHeaderCount method, GetHeaderNames method, GetHeaderValues method, GetUnparsedHeaders method.

Click to jump to top of pageClick to jump to parent topicGetHeaderNames

Syntax

GetHeaderNames()

Description

Use the GetHeaderNames method to return an array containing the names of all the headers.

This method is primarily used with inbound email messages.

Parameters

None.

Returns

An array of string.

See Also

MCFBodyPart class: AddHeader method, GetHeader method, GetHeaderCount method, GetHeaderName method, GetHeaderValues method, GetUnparsedHeaders method.

Click to jump to top of pageClick to jump to parent topicGetHeaderValues

Syntax

GetHeaderValues(Index)

Description

Use the GetHeaderValues method to return the value for the header located at the position specified by Index.

Parameters

Index

Specify the numeric position of the header whose value you want to access.

Returns

An array of string.

See Also

MCFBodyPart class: AddHeader method, GetHeader method, GetHeaderCount method, GetHeaderName method, GetHeaderNames method, GetUnparsedHeaders method.

Click to jump to top of pageClick to jump to parent topicGetUnparsedHeaders

Syntax

GetUnparsedHeaders()

Description

Use the GetUnparsedHeaders method to return all of the headers in the body part without any formatting occurring.

Parameters

None.

Returns

A string containing the headers.

See Also

MCFBodyPart class: AddHeader method, GetHeader method, GetHeaderCount method, GetHeaderName method, GetHeaderNames method, GetHeaderValues method.

Click to jump to top of pageClick to jump to parent topicSetAttachmentContent

Syntax

SetAttachmentContent({FilePath | FileURL}, FilePathType, FileName, FileDescr, OverrideContentType, OverrideCharset)

Description

Use the SetAttachmentContent method to specify the body (content) of this body part from a file.

Use the FilePathType parameter to specify if the file path is relative or absolute. If it's an absolute path, the file path could be a file on the local machine, a network folder, or a fully-qualified URL.

Parameters

FilePath | FileURL

You can either specify the file path to the file, or a URL to the file.

Depending on the FilePathType parameter, you may specify either a relative or absolute file path to the file.

This parameter should include the file name and extension of the file.

If you specify a URL address where the file is located, it must be an absolute URL. This URL should include the actual name of the file. If you specify a URL address, you must specify the FilePathType parameter as %FilePath_Absolute.

FilePathType

Specify the path type for the file, whether it is an absolute or relative path. The values are:

  • %FilePath_Absolute — the file path is an absolute path.

  • %FilePath_Relative — the file path is a relative path.

FileName

Specify the name of the file that you want to attach, as a string. You must include the file extension as well.

Description

Specify a description of the file.

OverrideContentType

The system detects the content type of the attachment using the file location and name. Specifying OverrideContentType overrides the system detected content type.

The character set can also be included in the ContentType. For example, “text/plain; charset=US-ASCII”

OverrideCharset

Specify a character set to be used to override the existing character set.

Returns

None.

Example

The following uses an absolute path to set the content:

&image.SetAttachmentContent("///file:C:/User/Documentum/XML%20Applications/proddoc⇒ /peoplebook_upc/peoplebook_upc.dtd", %FilePath_Absolute, "sample.jpg", "This is a sample image!", "", "");

The following uses a relative path to set the content:

&attach1.SetAttachmentContent("Ocean Wave.jpg", %FilePath_Relative, "Ocean Wave.jpg", "Ocean Wave", "", "");

The following uses a URL to set the content:

&attach1.SetAttachmentContent("http://www.yahoo.com/members_agreement", %FilePath_Absolute, "hotmail.htm", "Hotmail Home page", "", "");

See Also

AddAttachment

Click to jump to parent topicMCFBodyPart Class Properties

In this section we discuss the MCFBodyPart class properties. The properties are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicAttachmentURL

Description

Use this property to specify the URL for the attachment for this body part, as a string.

The URL must be an absolute URL.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicCharset

Description

Use this property to specify the character set for the text or the attachment.

You can also specify this property using the SetAttachmentContent method, or the ContentType property.

This property is read-write.

See Also

ContentType

SetAttachmentContent

Click to jump to top of pageClick to jump to parent topicContentType

Description

Use this property to specify the content type of this body part.

You can specify the content type with the SetAttachmentContent method.

You can also use this property to specify the character set. For example, “text/plain; charset=US-ASCII”.

This property is read-write.

See Also

SetAttachmentContent

Charset

Click to jump to top of pageClick to jump to parent topicDescription

Description

Use this property to specify a description of the attachment. You should only use this property if the content is an attachment.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicDisposition

Description

Use this property to specify how the body part is presented in the received mail.

Some email clients ignore the setting of this property and present body parts either inline or as file attachments.

Valid values for this property are:

Value

Description

Attachment

The body part is shown as a file attachment.

Inline

The body part is shown in the body itself.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicFilename

Description

If you are adding an attachment to the email, use this property to specify the name of the file.

PeopleSoft recommends that you keep the file extension specified with this property the same as the original extension found in the file path, otherwise client applications may not be able to display it properly.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicFilePath

Description

Specify the path for the file that contains the contents of this email.

Whether this is a relative or absolute path depends on the FilePathType property.

You can also specify a URL to the file using this property, if the FilePathType property is specified as %FilePath_Absolute.

If you specify a value for this property, the ‘Text’ content is ignored.

This property is read-write.

See Also

FilePathType

Click to jump to top of pageClick to jump to parent topicFilePathType

Description

Use this property to specify whether the path specified with the FilePath property is a relative or absolute path. The values for this property are:

Value

Description

%FilePath_Relative

The file path specified with the FilePath property is a relative path.

%FilePath_Absolute

The file path specified with the FilePath property is either an absolute path to a file, or a URL to a file.

If you specify a relative path, the file must be available in the FILES folder of application server folder.

If you specify an absolute path, the file could be on the local machine, in any network folder, or a URL.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicIsAttachment

Description

This property indicates if the body part is an attachment or not. This property returns a Boolean value: true if it is an attachment, false otherwise.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicMultiPart

Description

A bodypart can contain simple text, one attachment, or a MultiPart object.

If you have assigned a MultiPart object using this property, the text and attachment related properties are ignored.

This property is read-write.

Example

Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart(); &mp.SubType = "alternative; differences=Content-type"; &mp.AddBodyPart(&text); &mp.AddBodyPart(&html); ​&email.MultiPart = ∓ ​

Click to jump to top of pageClick to jump to parent topicText

Description

Use this property to specify the text for the email.

Use the SetAttachmentContent method to specify image or other types of attachments. For a more complex bodypart, build a multipart and set the Multipart property of MCFBodyPart.

This property is read-write.

See Also

SetAttachmentContent

Click to jump to parent topicMCFEmail Class

This class inherits many properties from the MCFPart class, and is the superclass class for both the MCFOutboundEmail and MCFInboundEmail classes. Generally, you only use the MCFOutboundEmail and MCFInboundEmail classes. You should only use the MCFEmail class if you are extending the PT_MCF_MAIL application package.

Click to jump to parent topicMCFEmail Class Properties

In this section, we discuss the MCFEmail class properties. The properties are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicBCC

Description

Use this property to specify comma-separated list of addresses of all the blind carbon copy recipients of this email. (A blind carbon copy is a copy of the email that contains all of the text of the email, but does not show any of the other email addresses to which this email was sent.)

This property is read-write.

See Also

MCFEmail class: CC property.

Click to jump to top of pageClick to jump to parent topicBounceTo

Description

Use this property to specify the email address the system should direct all bounced mail to.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicCC

Description

Use this property to specify a comma-separated list of addresses that copies of this email are to be sent to (carbon copy.)

This property is read-write.

See Also

MCFEmail class: BCC property.

Click to jump to top of pageClick to jump to parent topicFrom

Description

Use this property to specify the email address of the person sending the email.

You can specify more than one address as from in a comma-separated list.

This property is read-write.

See Also

MCFEmail class: Recipients property, ReplyTo property, Sender property.

Click to jump to top of pageClick to jump to parent topicImportance

Description

Use this property to specify the value of the importance header field.

The importance can be set to the following:

If the Priority property is not set, the system automatically sets it to the corresponding values like 5, 3 and 1.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicPriority

Description

Use this property to specify the priority of this email.

The values are:

  1. Highest Priority

  2. High Priority

  3. Normal

  4. Low Priority

  5. Lowest Priority

The default value is 3, that is, normal priority.

This value set with this property is used to set to a header X-Priority field, as this is the most common but non-standard field to show priority. In addition, the corresponding values are set in two header fields: X-MSMail-Priority and Priority. The headers X-Priority or X-MSMail-Priority are set to the corresponding value only if the user does not specify a value.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicRecipients

Description

Use this property to specify the email addresses of all the main recipients to whom the email is being sent. All the addresses are specified in a comma-separated string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicRefIDs

Description

Use this property to specify a value for the REFERENCES header field of the message.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicReplyIDs

Description

Use this property to specify a value for the IN-REPLY-TO header field of the message.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicReplyTo

Description

Use this property to specify the email address where the reply should be sent. You do not need to specify a value for this property if the value is the same as the From property.

This property is read-write.

See Also

MCFEmail class: From property.

Click to jump to top of pageClick to jump to parent topicSender

Description

Use this property to specify the address of the author of the message. You do not need to specify a value for this property if the value for the From property is the same.

This property is read-write.

See Also

MCFEmail class: From property.

Click to jump to top of pageClick to jump to parent topicSensitivity

Description

Use this property to specify the value of the sensitivity header field.

The values are:

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSubject

Description

Use this property to specify the subject of the email. A subject can only contain 254 characters.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicText

Description

Use this property to specify the text of the email.

This property is read-write.

Click to jump to parent topicMCFGetMail Class Methods

This section discusses MCFGetMail class methods.

Click to jump to top of pageClick to jump to parent topicCreateQuarantineFolder

Syntax

CreateQuarantineFolder()

Description

Use the CreateQuarantineFolder method to create a quarantine folder on the server. Specify the name of the folder using the QuarantineFolder property

Parameters

None.

Returns

A Boolean value; true if the folder is created, or if it already exists on the server, false otherwise.

See Also

QuarantineFolder, QuarantineCount.

Click to jump to top of pageClick to jump to parent topicGetCount

Syntax

GetCount()

Description

Use the GetCount method to determine the total number of emails currently stored in a particular email account.

This method does not distinguish between read and unread emails.

This method uses the connection properties set by SetMCFEmail.

If you want to determine the number of emails for an account, and to set your own connection properties, use the GetEmailCount method instead.

Parameters

None.

Returns

Returns the total number of emails stored on the mail server for a particular email account. If the method returns –4, the system could not connect to the mail server using the user name and password passed in the parameter list.

See Also

GetEmailCount, SetMCFEmail.

Click to jump to top of pageClick to jump to parent topicGetEmailCount

Syntax

GetEmailCount(user, password, server, node)

Description

Use GetEmailCount to determine the number of emails currently stored in a particular email account. GetEmailCount does not distinguish between read and unread email. You can use this value to set limits on loops in your program.

If you want to determine the number of emails for an account using the connection properties set with SetMCFEmail, use the GetCount method instead.

Parameters

user

The user name on the mail server, such as “support” or “john_doe”.

password

The password associated with the specified user name.

server

The name of the mail server handling the specified user account.

node

The Integration Broker node on which the request runs.

Note. If the value of any of these parameters is null, the method uses default values stored on the specified node. If the node is not specified, Integration Broker returns an error.

Returns

Returns the total number of emails stored on the mail server for a particular email account. If the method returns –4, the system could not connect to the mail server using the user name and password passed in the parameter list.

Example

Local number &email_count; &email_count = &gm.GetEmailCount(&username, &passwd, &mailserver, &node);

See Also

GetCount, SetMCFEmail.

Click to jump to top of pageClick to jump to parent topicReadAllEmailHeadersWithAttach

Syntax

ReadAllEmailHeadersWithAttach(user, password, server, node)

Description

Use ReadAllEmailHeadersWithAttach to read the headers of all of the emails and a list of associated attachments that are currently stored on the mail server for a particular email account. The details about the emails are returned in the level zero rowset. The actual emails and any associated attachments are not returned.

Use this method as a screening method to determine whether to store an email in your PeopleSoft system. For example, if you determine that an email is junk mail, you could delete it from your mail server. After you determine the allowable email through header information, you can retrieve the physical email and attachments of the allowable emails.

Parameters

user

The user name on the mail server, such as “support” or “john_doe”.

password

The password associated with the specified user name.

server

The name of the mail server handling the specified user account.

node

The Integration Broker node on which the request runs.

Note. If the value of any of these parameters is null, the method uses default values stored on the specified node. If the node is not specified, Integration Broker returns an error.

Returns

This method returns rowsets containing email headers.

Example

import PT_MCF_MAIL:*; Local MCFGetMail &gm; Local Rowset &emails_rs; &emails_rs = &gm.ReadAllEmailHeadersWithAttach(&username, &passwd, &mailserver &node);

Click to jump to top of pageClick to jump to parent topicReadEmails

Syntax

ReadEmails(Count)

Description

Use the ReadEmails method to read the specified number of emails for this mailbox.

This method uses the connection properties set by SetMCFEmail.

The overall status of the success of this method is available in the Status property.

Parameters

Count

Specify the number of emails you want to read.

Returns

An array of MCFInboundEmail.

See Also

MCFInboundEmail Class Methods

Status

Click to jump to top of pageClick to jump to parent topicReadEmailsWithAttach

Syntax

ReadEmailsWithAttach(User, password, server, node, count)

Description

The ReadEmailsWithAttach method reads the number of emails specified by count for a particular user account. If attachments are associated with an email, this method reads the attachments as well.

Parameters

User

Specify the user account that contains the emails you want to access, such as “support” or “john_doe”.

password

The password associated with the specified user name.

server

The name of the mail server handling the specified user account.

node

The Integration Broker node on which the request runs.

count

Specifies the number of emails to read. If count = 0, the method reads all the emails of the user account. If count > 0, the method reads the number specified. For example, if count = 10, the method reads 10 emails.

Note. If the value of any of these parameters is null, the method uses default values stored on the specified node. If the node is not specified, Integration Broker returns an error.

Returns

This method returns an email within a rowset. level one of the rowset contains the email parts. level zero row 1 only contains values for MCF_NUMROWS and MCF_RET_STATUS.

Example

import PT_MCF_MAIL:*; Local MCFGetMail &gm; Local Rowset &emails_rs; &emails_rs = &gm.ReadEmailsWithAttach(&username, &passwd, &mailserver &node, &email_count);

See Also

ReadEmailWithAttach

Click to jump to top of pageClick to jump to parent topicReadEmailsWithUID

Syntax

ReadEmailsWithUID(UID)

Description

Use the ReadEmailsWithUID method to read and return an email based on a unique identifier UID. This method uses the connection properties set by SetMCFEmail. Emails that have an attachment are also read.

Parameters

UID_List

The UID is the unique identifier of the email. This parameter is only unique within a particular user account. POP3 and IMAP 4 mail servers automatically create a unique identifier for an email when the server receives the email. The list can contain multiple values, each separated by a space.

Returns

A reference to an array of MCFInboundEmail.

See Also

MCFInboundEmail Class Methods

Click to jump to top of pageClick to jump to parent topicReadEmailWithAttach

Syntax

ReadEmailWithAttach(User, password, server, node, UID)

Description

Use the ReadEmailWithAttach method to read and return an email based on a unique identifier (UID) for the specific email to be read. If attachments are associated with this email, ReadEmailWithAttach fetches those as well.

Parameters

user

The user name on the mail server, such as “support” or “john_doe”.

password

The password associated with the specified user name.

server

The name of the mail server handling the specified user account.

node

The Integration Broker node on which the request runs.

UID

The unique identifier of the email. This parameter is only unique within a particular user account. POP3 and IMAP 4 mail servers automatically create a unique identifier for an email when the server receives the email.

You may specify more than one UID, each separated by a space.

Note. If the value of any of these parameters is null, the method uses default values stored on the specified node. If the node is not specified, Integration Broker returns an error.

Returns

This method returns an email within a rowset. level one of the rowset contains the email parts. level zero row 1 only contains values for MCF_NUMROWS and MCF_RET_STATUS.

Example

import PT_MCF_MAIL:*; Local MCFGetMail &gm; Local Rowset &emails_rs; &emails_rs = &gm.ReadEmailWithAttach(&username, &passwd, &mailserver, &node, &UID);

See Also

ReadEmailsWithAttach

Click to jump to top of pageClick to jump to parent topicReadHeaders

Syntax

ReadHeaders()

Description

Use the ReadHeaders method to read the headers of all emails currently on the server. This method also returns the attachment information for all emails (names and sizes.)

This method uses the connection properties set by SetMCFEmail.

The overall success of the method is available using the Status property.

Parameters

None.

Returns

An array of MCFInboundEmail objects.

See Also

MCFInboundEmail Class Methods

SetMCFEmail

Click to jump to top of pageClick to jump to parent topicRemoveEmail

Syntax

RemoveEmail(user, password, server, node, UID list)

Description

Based on values in the unique identifier list, RemoveEmail deletes emails from the user account on the mail server. It is important to delete emails from the mail server once they are read into PeopleSoft. If you do not delete emails from the mail server after they are read into PeopleSoft, the rowset contains the same collection of email the next time you retrieve email from the mail server.

Parameters

user

The user name on the mail server, such as “support” or “john_doe”.

password

The password associated with the specified user name.

server

The name of the mail server handling the specified user account.

node

The Integration Broker node on which the request runs.

UID list

The UID list contains the unique identifier values for the emails that need to be deleted from the mail server. The list can contain multiple values separated by a space.

Note. If the value of any of these parameters is null, the method uses default values stored on the specified node. If the node is not specified, the Integration Broker returns an error.

Returns

A Boolean value, indicating the status of the deletion process. If the email has been successfully, this method returns True. Otherwise the method returns False.

Example

Local MCFGetMail &GM; Local boolean &del_status; Local string &uid_list = ""; Local string &msg_str; If (&uid_list <> "") Then &del_status = &GM.RemoveEmail(&user, &password, &server, &ibnode, &uid_list); &msg_str = "Email(s) deleted from the Mail Server with UID = " | &uid_list; MessageBox(0, "", 0, 0, &msg_str); End-If;

See Also

RemoveEmails

Click to jump to top of pageClick to jump to parent topicRemoveEmails

Syntax

RemoveEmails(UID_List)

Description

Use the RemoveEmails method to delete emails from an account on the mail server, based on the UID_list. It is important to delete emails from the mail server once they are read into PeopleSoft. If you do not delete emails from the mail server after they are read into PeopleSoft, the rowset contains the same collection of email the next time you retrieve email from the mail server.

Parameters

UID_List

The UID list contains the unique identifier values for the emails that need to be deleted from the mail server. The list can contain multiple values separated by a space.

Returns

An array of string containing UIDs of the messages that were successfully removed, separated by semicolons.

See Also

RemoveEmail

Click to jump to top of pageClick to jump to parent topicSetMCFEmail

Syntax

SetMCFEmail(user, password, server, node)

Description

Use the SetMCFEmail method to set the connection properties for subsequent method calls.

This method is a shortcut for setting the UserId, Password, MailServer, and IBNode properties.

Parameters

user

The user name on the mail server, such as “support” or “john_doe”.

password

The password associated with the specified user name.

server

The name of the mail server handling the specified user account.

node

The Integration Broker node on which the request runs.

Note. If the value of any of these parameters is null, the method uses default values stored on the specified node. If the node is not specified, the integration broker returns an error.

Returns

None.

See Also

GetCount, ReadEmails, ReadEmailsWithUID, ReadHeaders.

Click to jump to parent topicMCFGetMail Class Properties

In this section we discuss the MCFGetMail class properties. The properties are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicAttachmentRoot

Description

Use this property to specify the root directory where the attachments are stored. If not specified, the value from the node is used.

Valid metastrings that can be included in the value for this property are:

%CURRDATE%

Current date in YYYYMMDD format

%CURRHOUR%

Current hour in 24–hour format (00-23)

%DBNAME%

Current value of %DbName system variable.

%OPRID%

Current value of %UserId system variable.

This property is read-write.

Example

To have the attachment root directory change hourly, you could use the following code example:

&MyEmail.AttachmentRoot = "c:\temp\%CURRDATE%\%CURRHOUR%\";

Click to jump to top of pageClick to jump to parent topicContentTypes

Description

Use this property to specify content types that should be returned in the message or part text rather than stored in the directory that contains the attachments. Specify content types in a comma separated list. For example: "text/html,text/xml".

Note. "Text/plain" is always returned in the text field and does not need to be included.

If not specified, the value from the node is used.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicErrorCount

Description

This property returns the number of messages that caused errors during processing on the target connector.

You should use this property after you use the ReadHeaders, ReadEmails, ReadEmailsWithUID, or RemoveEmails methods.

This property is read-only.

See Also

ReadHeaders, ReadEmails, ReadEmailsWithUID, RemoveEmails.

Click to jump to top of pageClick to jump to parent topicIBNode

Description

This property returns the name of the Integration Broker node on which a request ran, such as MCF_GetMail.

This property is set by the SetMCFEmail method. It is used by ReadHeaders, ReadEmails, ReadEmailsWithUID, RemoveEmails, and CreateQuarantineFolder methods.

This property is read-write.

See Also

ReadHeaders, ReadEmails, ReadEmailsWithUID, RemoveEmails, CreateQuarantineFolder.

Click to jump to top of pageClick to jump to parent topicMailServer

Description

This property returns the name of the mail server that received the email.

This property is set by the SetMCFEmail method. It is used by ReadHeaders, ReadEmails, ReadEmailsWithUID, RemoveEmails, and CreateQuarantineFolder methods.

This property is read-write.

See Also

ReadHeaders, ReadEmails, ReadEmailsWithUID, RemoveEmails, CreateQuarantineFolder.

Click to jump to top of pageClick to jump to parent topicPassword

Description

This property returns the password associated with the userID that was used to get the email.

This property is set by the SetMCFEmail method. It is used by ReadHeaders, ReadEmails, ReadEmailsWithUID, RemoveEmails, and CreateQuarantineFolder methods.

This property is read-write.

See Also

ReadHeaders, ReadEmails, ReadEmailsWithUID, RemoveEmails, CreateQuarantineFolder.

Click to jump to top of pageClick to jump to parent topicQuarantineCount

Description

This property returns the number of email messages that caused errors during processing on the target connector and were successfully moved to the quarantine folder.

This property is valid after calls to ReadHeaders, ReadEmails, ReadEmailsWithUID, and RemoveEmails.

This property is read-only.

See Also

QuarantineFolder

ReadHeaders, ReadEmails, ReadEmailsWithUID, RemoveEmails.

Click to jump to top of pageClick to jump to parent topicQuarantineFolder

Description

Use this property to specify the name of the quarantine folder. If not specified, the value from the node will be used.

The name must adhere to whatever naming restrictions are imposed by the mail server in use. There is no built-in validation of the folder name.

The following types of errors can cause an email to be moved to the quarantine folder:

This property is read-write.

See Also

QuarantineCount

Click to jump to top of pageClick to jump to parent topicStatus

Description

This property returns the status of the last mail server operation.

See Error Messages Returned by MCFGetMail Class Methods.

This property is valid after calls to ReadHeaders, ReadEmails, ReadEmailsWithUID, and RemoveEmails.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicUserID

Description

This property returns the user ID (mail box) on the mail server that received the email.

This property is set by SetMCFEmail. It is used by ReadHeaders, ReadEmails, ReadEmailsWithUID,RemoveEmails, and CreateQuarantineFolder methods.

This property is read-write.

Click to jump to parent topicMCFInboundEmail Class

This class inherits many properties from the MCFEmail class, which in turn inherits many properties from the MCFPart class. Generally, you use only the subclasses, MCFInboundEmail and MCFOutboundEmail, and not the superclasses.

Click to jump to parent topicMCFInboundEmail Class Methods

In this section, we discuss the MCFInboundEmail class methods. The methods are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicDumpToFile

Syntax

DumpToFile(&File)

Description

Use the DumpToFile method to write information from the email to an already instantiated file.

This method copies the information from the following email properties, placing each on a separate line:

Whether the information is appended to the bottom of the file or if it overwrites the file depends on how you instantiated the file object.

Parameters

&File

Specify an already instantiated file object that you want to write the email data to.

Returns

None.

Example

Local File &BI_FILE; &BI_FILE = GetFile("mcfdata.out", "w", "a"); Local PT_MCF_MAIL:MCFGetMail &gm; Local number &ret_status, &nemails, &i; &gm = create PT_MCF_MAIL:MCFGetMail(); Local array of PT_MCF_MAIL:MCFInboundEmail &emails; &gm.SetMCFEmail(&user, &password, &server, &ibnode); &emails = &gm.ReadEmails(0); If (&gm.StatusCheck(&BI_FILE) = False) Then Return; End-If; &nemails = &emails.Len; &ret_status = &gm.Status; If &nemails > 0 Then For &i = 1 To &nemails &BI_FILE.WriteLine(MsgGetText(162, 1615, "Message Not Found", &i)); &emails [&i].DumpToFile(&BI_FILE); End-For; End-If;

See Also

File Class

GetFile

Click to jump to top of pageClick to jump to parent topicGetAttachments

Syntax

GetAttachments()

Description

Use the GetAttachments method to return the attachments with this email.

Parameters

None.

Returns

An array of MCFBodyPart objects. The methods returns an array of length 0 if there are no attachments

See Also

Array Class

MCFBodyPart Class Methods

Click to jump to top of pageClick to jump to parent topicGetFrom

Syntax

GetFrom()

Description

Use the GetFrom method to split the semicolon delimited list of addresses in the From property into an array of addresses.

Parameters

None.

Returns

An array of string. Each item in the array contains an email address.

See Also

From

Click to jump to top of pageClick to jump to parent topicGetParts

Syntax

GetParts()

Description

Use the GetParts method to return all of this email's parts.

Parameters

None.

Returns

An array of MCFBodyPart objects.

See Also

MCFBodyPart Class Methods

Click to jump to top of pageClick to jump to parent topicGetSender

Syntax

GetSender()

Description

Use the GetSender method to split the semicolon delimited list of addresses in the Sender property into an array of addresses.

Parameters

None.

Returns

An array of string.

See Also

Sender

GetFrom

Click to jump to top of pageClick to jump to parent topicReadFromDatabase

Syntax

ReadFromDatabase(Email_ID)

Description

Use the ReadFromDatabase method to load a saved email from the database into this instance of email.

Parameters

Email_ID

Specify the ID of the email, as a number.

Returns

A Boolean: true if the email is restored successfully, false otherwise.

See Also

SaveToDatabase

Click to jump to top of pageClick to jump to parent topicSaveToDatabase

Syntax

SaveToDatabase()

Description

Use the SaveToDatabase method to save this instance of email to the database.

Parameters

None.

Returns

A number, representing the email_ID of the saved email.

See Also

ReadFromDatabase

Click to jump to parent topicMCFInboundEmail Class Properties

In this section, we discuss the MCFInboundEmail class properties. The properties are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicAttachList

Description

This property returns the list of all the file names that are attachments for a particular email.

Multiple items are separated by a semicolon (;).

This property is read-write.

See Also

AttachSizes

Click to jump to top of pageClick to jump to parent topicAttachSizes

Description

This property returns the sizes of the attachments associated with an email.

This property takes a string value, not a numeric value. Multiple values are separated by a semicolon (;).

The attachment sizes appear in the same order as the file names in AttachList.

This property is read-write.

See Also

AttachList

Click to jump to top of pageClick to jump to parent topicDttmReceived

Description

Use this property to return the date and time an email was received.

Warning! If you are using a Post Office Protocol 3 (POP3) mail server, this property may not be populated.

This property takes a DateTime value.

This property is read-write.

See Also

DttmSaved, DttmSent.

Click to jump to top of pageClick to jump to parent topicDttmSaved

Description

This property returns the date and time that the PeopleSoft system saved an email to the database.

If you use a POP3 mail server, PeopleSoft recommends using this value as the base, or starting point, for any time-sensitive transactions.

This property takes a DateTime value.

This property is read-write.

See Also

DttmReceived, DttmSent.

Click to jump to top of pageClick to jump to parent topicDttmSent

Description

This property returns the date time an email was sent.

This property takes a DateTime value.

This property is read-write.

See Also

DttmReceived, DttmSent.

Click to jump to top of pageClick to jump to parent topicIBNode

Description

This property returns the name of the Integration Broker node that received the email, such as MCF_GetMail.

The system uses this value to construct the fully qualified URL required for viewing attachments.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicLanguage

Description

This value reflects the language code of the Integration Broker node that received this email.

Note. PeopleSoft recommends setting up email accounts that are dedicated to one language such as, support_french@company.com and support_english@company.com. This enables you to anticipate the language of the email you read into your system. In turn, configure separate Integration Broker nodes to handle each of the languages you support. There are no language recognition procedures within the PeopleSoft system.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicMessageID

Description

Use this property to return the globally unique identifier for this email.

 

This ID is generated by the mail server that sent this email.

Click to jump to top of pageClick to jump to parent topicNotifyCC

Description

This property returns a list of the parties who were copied (carbon copied) on the email. Multiple addresses are separated by a semicolon (;).

This property is read-write.

Click to jump to top of pageClick to jump to parent topicNotifyTo

Description

This property returns a list of the parties who received the email. Multiple addresses are separated by a semicolon (;).

This property is read-write.

Click to jump to top of pageClick to jump to parent topicOffsetReceived

Description

This property returns time zone of the mail server that received this email, as a number.

Note. This property contains the time zone of the integration gateway used to fetch this email.

This property is read-write.

See Also

OffsetSent

Click to jump to top of pageClick to jump to parent topicOffsetSent

Description

This property returns the time zone of the mail server that sent this email, as a string.

Note. Currently, this property contains the time zone of the integration gateway used to fetch this email.

This property is read-write.

See Also

OffsetReceived

Click to jump to top of pageClick to jump to parent topicServer

Description

This property specifies the name of the mail server that received the email.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSize

Description

This property returns the total size of the entire email. This value includes the sizes of attachments.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicStatus

Description

This property returns the status of an individual email.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicUID

Description

This property returns the unique identifier of the email.

This property is only unique within a particular user account. POP3 and IMAP 4 mail servers automatically create a unique identifier for an email when the server receives the email.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicUser

Description

This property returns the user account (mail box) on the mail server that received the email.

This property is read-write.

Click to jump to parent topicMCFMailStore Class

Use the MCFMailStore class to write emails to the PeopleSoft database and to retrieve emails from the PeopleSoft database.

Note. When writing emails to the PeopleSoft database, it is assumed that you have previously used the MCFGetMail class to retrieve email into memory. You use the MCFMailStore class immediately after to save the rowsets to the database.

Click to jump to parent topicMCFMailStore Import Statements

Here is the import statement:

import PT_MCF_MAIL:MCFMailStore;

Click to jump to parent topicMCFMailStore Methods

This section discusses MCFMailStore class methods.

Click to jump to top of pageClick to jump to parent topicAuthorizeEmailAttach

Syntax

AuthorizeEmailAttach(email ID, authentication name, authentication type, operation)

Description

Use AuthorizeEmailAttach to authorize a user or a PeopleSoft role to view attachments associated with an email. By default, no user or role is authorized to view an email; you must explicitly grant authorization with this method. This method authorizes email and the associated attachments one at a time.

Note. If you specify ALL as the user, any user can view the attachments for an email.

Parameters

email ID

The unique email ID for the email. This is the PeopleSoft email ID, not the ID issued by the mail server.

authentication name

The name of the PeopleSoft user profile or role that needs to be authorized to view the attachments.

authentication type

Specify the type security definition entered as the authentication name.

  • Specify 2 to indicate a user profile.

  • Specify3 to indicate a role.

operation

Specify the type of authorization operation. The following list contains the supported operations. You either add or delete user or role authorization.

  • 1 = ADD

  • 2 = DELETE

Returns

Returns a Boolean value: True for success, False otherwise.

Example

&ms = create MCFMailStore(); &status = &ms.AuthorizeEmailAttach(&emailid, "MCFUser", 2, 1);

Click to jump to top of pageClick to jump to parent topicDeleteEmail

Syntax

DeleteEmail(email ID, forced delete)

Description

Deletes the specified email from the PeopleSoft database and corresponding attachments from the directory where they are stored.

Parameters

email ID

The ID used to uniquely identify each email within the PeopleSoft database.

forced delete

This parameter is used to set the forced delete flag. It is a Boolean value. A forced delete ensures that the deletion process continues even in cases where the process encounters issues or errors related to an email. For example, with forced delete enabled, the deletion process continues even though the attachments of the email cannot be found or do not exist.

True means “force delete” and False means “do not force delete if there is an error in deleting this email.”

Returns

Returns a Boolean value. True for success, False otherwise.

Example

Local MCFMailStore &ms; &ms = create MCFMailStore(); &forcedel = True; &status = &ms.DeleteEmail(&emailid, &forcedel);

Click to jump to top of pageClick to jump to parent topicRetrieveEmail

Syntax

RetrieveEmail(email ID)

Description

Use RetrieveEmail to read email from the PeopleSoft database.

Parameters

email ID

The ID that uniquely identifies an email within the PeopleSoft database.

Returns

Returns a rowset.

Example

Local MCFMailStore &ms; Local Rowset &EMAIL_ROWSET; &ms = create MCFMailStore(); &EMAIL_ROWSET = &ms.RetrieveEmail(&emailid);

Click to jump to top of pageClick to jump to parent topicStoreEmail

Syntax

StoreEmail(&rowset, row)

Description

The StoreEmail method inserts an email retrieved from the mail server into the PeopleSoft database. PeopleSoft stores the contents or pieces of the email in rowsets and child rowsets.

Parameters

&rowset

The rowset containing the contents of an email. The rowset should be the rowset used by the MCFGetMail class to retrieve emails from the mail server. The rowset should be an already instantiated rowset.

Note. The first row of the rowset is empty. The first email in the rowset has a row value of 2.

row

The row number in which the email data is stored.

Note. The first row is always empty. Row 2 always contains the first email of the rowset.

Returns

Returns a PeopleSoft email ID to act as the unique key for a particular email within the PeopleSoft database.

Returns 0 if an error occurred.

Example

Local MCFGetMail &GM; Local Rowset &rs; Local number &nemails; Local string &email_id; &GM = create MCFGetMail(); &rs = &GM.ReadEmailsWithAttach(&user, &password, &server, &ibnode, &count); /* Get the number of emails in the recordset from MCF_NUMROWS field */ &nemails = &rs.GetRow(1).GetRecord(Record.MCFEM_RES_MAIN).GetField (Field.MCF_NUMROWS).Value; If (&nemails > 0) Then /* First row in the rowset is for header info only. Start writing from second row */ For &i = 1 To &nemails &email_id = &ms.StoreEmail(&rs, &i + 1); If (&email_id <> 0) Then /* Store was successful - email ID returned = &email_id */ Else /* Error in storing email */ End-If; End-For; End-If;

Click to jump to parent topicMCFMailUtil Class

Use the MCFMailUtil class to perform utility operations including encoding and decoding text, validating the email address, validating the email domain name, and determining whether the SMTP email server is available.

Click to jump to parent topicMCFMailUtil Class Methods

In this section we discuss the MCFMailUtil class methods. The methods are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicDecodeText

Syntax

DecodeText(TextToDecode, &DecodedText)

Description

Use the DecodeText method to decode text. If you only want to decode a word, use the DecodeWord property.

The text is decoded based on the values used with the EncodeText method.

The decoded text is placed in the &DecodedText parameter.

This method returns true if successful. If the return value is false, the following MCFMailUtil properties are set accordingly:

In addition you can use the GetErrorMsgParam method to return each of the substitution strings used to format the error message.

Parameters

TextToDecode

Specify the text that is to be decoded, as a string.

&DecodedText

Specify a string variable, used to hold the decoded text.

Returns

A Boolean value: true if successful, false otherwise.

See Also

MCFMailUtil class: GetErrorMsgParam method, ErrorDescription property, ErrorDetails property, MessageNumber property, MessageSetNumber property.

DecodeWord, EncodeText.

Click to jump to top of pageClick to jump to parent topicDecodeWord

Syntax

DecodeWord(WordToDecode, &DecodedWord)

Description

Use the DecodeWord method to decode a word. If you want to decode a string, use the DecodeText method instead.

The word is decoded based on the values used with the EncodeWord method.

The decoded word is placed in the &DecodedWord parameter.

This method returns true if successful. If the return value is false, the following MCFMailUtil properties are set accordingly:

In addition you can use the GetErrorMsgParam method to return each of the substitution strings used to format the error message.

Parameters

WordToDecode

Specify the word that is to be decoded, as a string.

&DecodedWord

Specify a string variable, used to hold the decoded word.

Returns

A Boolean value: true if successful, false otherwise.

See Also

MCFMailUtil class: GetErrorMsgParam method, ErrorDescription property, ErrorDetails property, MessageNumber property, MessageSetNumber property.

DecodeText, EncodeWord.

Click to jump to top of pageClick to jump to parent topicEncodeText

Syntax

EncodeText(TextToEncode, charset, EncodingStyle, &EncodedText)

Description

Use the EncodeText method to encode text. If you only want to encode a single word, use the EncodeWord method instead.

The encoded text is placed in the &EncodedText parameter.

This method returns true if successful. If the return value is false, the following MCFMailUtil properties are set accordingly:

In addition you can use the GetErrorMsgParam method to return each of the substitution strings used to format the error message.

Using Encoding Styles

You can specify either “B” or “Q” for the EncodingStyle parameter, indicating either Base64 or “Quoted-Printable” content-transfer-encoding, respectively.

PeopleSoft recommends using the “Q” encoding when most of the characters to be encoded are in the ASCII character set; otherwise, you should use the “B” encoding. However, a mail reader that claims to recognize encoded text must be able to accept either encoding for any character set that it supports.

Both Base64 and “Quoted-Printable” content-transfer-encoding are defined by RCF 1521.

See http://www.freesoft.org/CIE/RFC/1522/4.htm

Parameters

TextToEncode

Specify the text that is to be encoded, as a string.

charset

Specify the character set to be used for encoding the text, as a string.

See Character Sets Across the Tiers of the PeopleSoft Architecture.

EncodingStyle

Specify the encoding style. Valid values are:

  • B — for Base64 encoding.

  • Q — for "Quoted-Printable" content- transfer-encoding.

&EncodedText

Specify a string variable used to hold the encoded text.

Returns

A Boolean value: true if successful, false otherwise.

See Also

MCFMailUtil class: GetErrorMsgParam method, ErrorDescription property, ErrorDetails property, MessageNumber property, MessageSetNumber property.

DecodeText, EncodeWord.

Click to jump to top of pageClick to jump to parent topicEncodeWord

Syntax

EncodeWord(WordToEncode, charset, EncodingStyle, &EncodedWord)

Description

Use the EncodeWord method to encode a word. If you want to encode more than a single word, use the EncodeText method.

The encoded word is placed in the &EncodedWord parameter.

This method returns true if successful. If the return value is false, the following MCFMailUtil properties are set accordingly:

In addition you can use the GetErrorMsgParam method to return each of the substitution strings used to format the error message.

Using Encoding Styles

You can specify either “B” or “Q” for the EncodingStyle parameter, indicating either Base64 or “Quoted-Printable” content-transfer-encoding, respectively.

PeopleSoft recommends using the “Q” encoding when most of the characters to be encoded are in the ASCII character set; otherwise, you should use the “B” encoding. However, a mail reader that claims to recognize encoded text must be able to accept either encoding for any character set that it supports.

Both Base64 and “Quoted-Printable” content-transfer-encoding are defined by RCF 1521.

See http://www.freesoft.org/CIE/RFC/1522/4.htm

Parameters

WordToEncode

Specify the word that is to be encoded, as a string.

charset

Specify the character set to be used for encoding the word, as a string.

See Character Sets Across the Tiers of the PeopleSoft Architecture.

EncodingStyle

Specify the encoding style. Valid values are:

  • B — for Base64 encoding.

  • Q — for "Quoted-Printable" content- transfer-encoding.

&EncodedWord

Specify a string variable, used to hold the encoded word.

Returns

A Boolean value: true if successful, false otherwise.

See Also

MCFMailUtil class: GetErrorMsgParam method, ErrorDescription property, ErrorDetails property, MessageNumber property, MessageSetNumber property.

DecodeWord, EncodeText.

Click to jump to top of pageClick to jump to parent topicGetErrorMsgParam

Syntax

GetErrorMsgParam(&index)

Description

Use this method to return each of the substitution strings used in the error message.

Parameters

&index

Specifies which substitution string to return from the array of substitution parameters.

Returns

A string containing the substitution parameter.

Example

Local PT_MCF_MAIL:MCFMailUtil &emailutil = create PT_MCF_MAIL:MCFMailUtil(); For &index = 1 To &emailutil.ErrorMsgParamsCount Local String &trace = "Param" | &index | ": '" | &emailutil.GetErrorMsgParam⇒ (&index) | "'"; End-For;

See Also

MCFMailUtil class: ErrorMsgParamsCount property.

Click to jump to top of pageClick to jump to parent topicIsDomainNameValid

Syntax

IsDomainNameValid(domainname)

Description

Use this method to check whether a domain name is valid. The isDomainNameValid method queries your DNS server to check whether the domain name is listed in an "MX", or mailbox exchange, record. Please note that not all domains are properly listed by DNS servers.

Note. The number of retries for domain validation is set by the SMTPDNSTimeoutRetries parameter in psappsrv.cfg. The default number of retries is 1.

This method returns true if successful. If the return value is false, the following MCFMailUtil properties are set accordingly:

In addition you can use the GetErrorMsgParam method to return each of the substitution strings used to format the error message.

Parameters

domainname

Specifies the domain name to be validated, as a string.

Returns

A Boolean value: true if the domain name is valid, false otherwise.

Example

Local PT_MCF_MAIL:MCFMailUtil &emailutil = create PT_MCF_MAIL:MCFMailUtil(); &result = &emailutil.IsDomainNameValid("oracle.com");

See Also

MCFMailUtil class: GetErrorMsgParam method, ErrorDescription property, ErrorDetails property, MessageNumber property, MessageSetNumber property.

SMTPDNSTimeoutRetries

Click to jump to top of pageClick to jump to parent topicIsEmailServerAvailable

Syntax

IsEmailServerAvailable(server, port, user, password)

Description

Use the IsEmailServerAvailable method to check if the email server specified with the SMTP settings in the application server configuration file is available.

This method returns true if successful. If the return value is false, the following MCFMailUtil properties are set accordingly:

In addition you can use the GetErrorMsgParam method to return each of the substitution strings used to format the error message.

Parameters

server

Specify the name of the mail server handling the specified user account, as a string.

port

Specify the port of the mail server handling the specified user account, as an integer.

user

Specify the user name on the mail server, such as “support” or “john_doe”, as a string.

password

Specify the password associated with the specified user name, as a string.

Returns

A Boolean value: true if the server is available, false otherwise.

See Also

MCFMailUtil class: GetErrorMsgParam method, ErrorDescription property, ErrorDetails property, MessageNumber property, MessageSetNumber property.

Setting Application Server Domain Parameters

Click to jump to top of pageClick to jump to parent topicParseRichTextHtml

Syntax

ParseRichTextHtml(richtext)

Description

Use this method to split rich text content with images into an array of MCFBodyPart objects. Typically, this method is used with rich text produced by the rich text editor on a long edit box.

The first element in the array is the text of the email message. The remaining elements in the array represent each image in the message. The images are added as inline parts of the email, rather than as attachments, preserving the original formatting of the HTML content.

Prior to sending the email, the images are stored in a temporary directory. The default directory is PS_SERVDIR/images. Use the MCFMailUtil class imagesLocation property to specify a different directory location. Images in this temporary directory must be deleted manually after sending the email; these image files are not deleted automatically.

Parameters

richtext

Rich text with images that needs to be parsed.

Returns

An array of MCFBodyPart objects.

Example

See the example on creating an email from rich text editor output later in this chapter.

See Also

MCFBodyPart Class

imagesLocation

Creating an Email from Rich Text Editor Output

Click to jump to top of pageClick to jump to parent topicValidateAddress

Syntax

ValidateAddress(addresslist)

In which addresslist is a list of email addresses in the form:

email_address1 [{,|;} email_address2] ...

Description

Use the ValidateAddress method to validate a comma- or semicolon-separated list of email addresses. This method checks the syntax of the email address. It does not verify the domain name or the validity of the user name.

This method returns true if successful. If the return value is false, the following MCFMailUtil properties are set accordingly:

In addition you can use the GetErrorMsgParam method to return each of the substitution strings used to format the error message.

Parameters

addresslist

Specify the email address (or addresses) you want to verify as a comma- or semicolon-separated list.

Returns

A Boolean value: true if the specified email addresses are valid, false otherwise. When ValidateAddress returns false, the badaddresses property will contain an array of all invalid addresses.

Example

import PT_MCF_MAIL:*; Local PT_MCF_MAIL:MCFMailUtil &emailutil = create PT_MCF_MAIL:MCFMailUtil(); Local boolean &result = &emailutil.ValidateAddress(&email.Recipients); Local array of string &bAddresses = &emailutil.badaddresses; If (&result = False) Then If (&bAddresses <> Null) Then &i = 0; While &bAddresses.Next(&i) Warning ("Bad email address in input = " | &bAddresses [&i]); End-While; End-If; End-If;

See Also

MCFMailUtil class: GetErrorMsgParam method, badaddresses property, ErrorDescription property, ErrorDetails property, MessageNumber property, MessageSetNumber property.

Click to jump to parent topicMCFMailUtil Class Properties

In this section we discuss the MCFMailUtil class properties. The properties are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicbadaddresses

Description

When the ValidateAddress method returns false, use the badaddresses property to get an array of invalid email addresses.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner. If this property has a user-specified value, that value will be overwritten automatically when there is an error condition.

See Also

MCFMailUtil class: ValidateAddress method.

Click to jump to top of pageClick to jump to parent topicErrorDescription

Description

If an error occurs, use the ErrorDescription property to get the description of the error.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner. If this property has a user-specified value, that value will be overwritten automatically when there is an error condition.

See Also

MCFMailUtil class: ErrorDetails property.

Click to jump to top of pageClick to jump to parent topicErrorDetails

Description

If an error occurs, use the ErrorDetails property to get the details for the error.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner. If this property has a user-specified value, that value will be overwritten automatically when there is an error condition.

See Also

MCFMailUtil class: ErrorDescription property.

Click to jump to top of pageClick to jump to parent topicErrorMsgParamsCount

Description

Use this property to return the number of substitution parameters as an integer.

This property is read-only.

See Also

MCFMailUtil class: GetErrorMsgParam method.

Click to jump to top of pageClick to jump to parent topicimagesLocation

Description

Use this property to specify a string representing a temporary directory for image storage to be used by the ParseRichTextHtml method. Images in this temporary directory must be deleted manually after sending the email; these image files are not deleted automatically.

If this property is not specified, the default image directory is PS_SERVDIR/images.

This property is read-write.

See Also

ParseRichTextHtml

Creating an Email from Rich Text Editor Output

Click to jump to top of pageClick to jump to parent topicMessageNumber

Description

This property returns the message number of the error message associated with the failed mail utility method. The message number is associated with messages in the PeopleTools message catalog.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner. If this property has a user-specified value, that value will be overwritten automatically when there is an error condition.

See Also

MCFMailUtil class: MessageSetNumber property.

Click to jump to top of pageClick to jump to parent topicMessageSetNumber

Description

This property returns the message set number of the error message associated with the failed mail utility method. The message set number is associated with messages in the PeopleTools message catalog.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner. If this property has a user-specified value, that value will be overwritten automatically when there is an error condition.

See Also

MCFMailUtil class: MessageNumber property.

Click to jump to parent topicMCFMultiPart Class

Use the MCFMultiPart class to create complex emails with attachments, HTML content, and so on.

Click to jump to parent topicMCFMultiPart Class Methods

In this section, we discuss the MCFMultiPart class methods. The methods are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicAddBodyPart

Syntax

AddBodyPart(&bodyPart)

Description

Use the AddBodyPart method to add the specified body part to this multipart email.

Parameters

&bodyPart

Specify an already instantiated MCFBodyPart object.

Returns

None.

Click to jump to top of pageClick to jump to parent topicGetBodyPart

Syntax

GetBodyPart(Index)

Description

Use the GetBodyPart method to return a reference to the body part specified by Index.

Parameters

Index

Specify the numeric position of the body part you want to access.

Returns

A reference to an MCFBodyPart object.

See Also

MCFBodyPart Class Methods

Click to jump to top of pageClick to jump to parent topicGetContentType

Syntax

GetContentType()

Description

Use the GetContentType method to determine the content type.

Parameters

None.

Returns

A string.

Click to jump to top of pageClick to jump to parent topicGetCount

Syntax

GetCount()

Description

Use the GetCount method to return the number of parts in the MCFMultiPart object.

Parameters

None.

Returns

A number.

Click to jump to parent topicMCFMultiPart Class Property

In this section we discuss the MCFMultiPart class property.

Click to jump to top of pageClick to jump to parent topicSubType

Description

Use this property to specify the subtype of the MCFMultiPart object. The values are:

The default value is mixed.

This property is read-write.

Click to jump to parent topicMCFOutboundEmail Class

This class inherits many properties from the MCFEmail class, which in turn inherits many properties from the MCFPart class. Generally, you use only the subclasses, MCFOutboundEmail and MCFInboundEmail, and not the superclasses.

Click to jump to parent topicMCFOutboundEmail Class Methods

In this section, we discuss the MCFOutboundEmail class methods. The methods are discussed in alphabetical order.

Click to jump to top of pageClick to jump to parent topicAddAttachment

Syntax

AddAttachment({FilePath | FileURL}, FilePathType, FileName, FileDescr, OverrideContentType, OverrideCharset)

Description

Use the AddAttachment method to add an attachment to this email.

Use the FilePathType parameter to specify if the file path is relative or absolute. If it's an absolute path, the file path could be a file on the local machine, a network folder, or a fully-qualified URL.

You can also add an attachment by creating a multipart object, adding the attachments as bodyparts to the multipart object, and then setting the MultiPart property of the MCFOutbounEmail object. The AddAttachment method is provided for convenience.

Parameters

FilePath | FileURL

You can either specify the file path to the file, or a URL to the file.

Depending on the FilePathType parameter, you may specify either a relative or absolute file path to the file.

This parameter should include the file name and extension of the file.

If you specify a URL address where the file is located, it must be an absolute URL. This URL should include the actual name of the file. If you specify a URL address, you must specify the FilePathType parameter as %FilePath_Absolute.

FilePathType

Specify the path type for the file, whether it is an absolute or relative path. The values are:

  • %FilePath_Absolute — the file path is an absolute path.

  • %FilePath_Relative — the file path is a relative path.

FileName

Specify the name of the file that you want to attach, as a string. You must include the file extension as well.

Description

Specify a description of the file.

OverrideContentType

The system detects the content type of the attachment using the file location and name. Specifying OverrideContentType overrides the system detected content type.

The character set can also be included in the ContentType. For example, “text/plain; charset=US-ASCII”

OverrideCharset

Specify a character set to be used to override the existing character set.

Returns

None.

Click to jump to top of pageClick to jump to parent topicAddHeader

Syntax

AddHeader(HeaderName, HeaderValue)

Description

Use the AddHeader method to add a header to the email. This method allows for email server customizations. Some commonly used headers are already exposed as properties, such as From, To, Subject, ContentType and ContentLanguage. Advanced applications can adapt this technique to meet their own requirements. These headers can be either standard SMTP headers or custom headers starting with "X-".

Parameters

HeaderName

Specify the name of the header that you want to add. This parameter takes a string value.

HeaderValue

Specify the actual text of the header, as a string.

Returns

None.

Example

 

Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail⇒ (); Local string &TestName = "Custom Header"; &email.From = &def.From; &email.Recipients = &def.Recipients; &email.SMTPServer = &def.SMTPServer; &email.Subject = &TestName; &email.Text = &TestName; &email.AddHeader("X-Mailer", "CRM Sales Application 8.9 SP2"); &email.AddHeader("X-Mailer", "CRM Sales Application 8.9 SP3"); &email.AddHeader("X-Mailer", "CRM Sales Application 8.9 SP4"); &res = &email.Send();

See Also

MCFEmail class: GetHeader method, GetHeaderCount method, GetHeaderName method, GetHeaderNames method, GetHeaderValues method.

Click to jump to top of pageClick to jump to parent topicGetErrorMsgParam

Syntax

GetErrorMsgParam(&index)

Description

Use this method to return each of the substitution strings used in the error message.

Parameters

&index

Specifies which substitution string to return from the array of substitution parameters.

Returns

A string containing the substitution parameter.

Example

Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail(); For &index = 1 To &email.ErrorMsgParamsCount Local String &trace = "Param" | &index | ": '" | &email.GetErrorMsgParam⇒ (&index) | "'"; End-For;

See Also

MCFMailUtil class: ErrorMsgParamsCount property.

Click to jump to top of pageClick to jump to parent topicGetHeader

Syntax

GetHeader(HeaderName)

Description

Use the GetHeader method to return the value of the specified header.

Parameters

HeaderName

Specify the name of the header that you want to access the values for, as a string.

The matching of header names is case insensitive.

Returns

An array of string containing the header values. If the header is not present, returns an array of length zero.

See Also

MCFEmail class: AddHeader method, GetHeaderCount method, GetHeaderName method, GetHeaderNames method, GetHeaderValues method.

Array Class

Click to jump to top of pageClick to jump to parent topicGetHeaderCount

Syntax

GetHeaderCount()

Description

Use the GetHeaderCount method to return the number of headers.

Parameters

None.

Returns

An integer, representing the number of headers present.

See Also

MCFEmail class: AddHeader method, GetHeader method, GetHeaderName method, GetHeaderNames method, GetHeaderValues method.

Click to jump to top of pageClick to jump to parent topicGetHeaderName

Syntax

GetHeaderName(Index)

Description

Use the GetHeaderName to return the name of the header that is located at Index.

Parameters

Index

Specify the numeric position of the header you want to access.

Returns

A string.

See Also

MCFEmail class: AddHeader method, GetHeader method, GetHeaderCount method, GetHeaderNames method, GetHeaderValues method.

Click to jump to top of pageClick to jump to parent topicGetHeaderNames

Syntax

GetHeaderNames()

Description

Use the GetHeaderNames method to return an array containing the names of all the headers.

Parameters

None.

Returns

An array of string.

See Also

MCFEmail class: AddHeader method, GetHeader method, GetHeaderCount method, GetHeaderName method, GetHeaderValues method.

Click to jump to top of pageClick to jump to parent topicGetHeaderValues

Syntax

GetHeaderValues(Index)

Description

Use the GetHeaderValues method to return the value for the header located at the position specified by Index.

Parameters

Index

Specify the numeric position of the header whose value you want to access.

Returns

An array of string.

See Also

MCFEmail class: AddHeader method, GetHeader method, GetHeaderCount method, GetHeaderName method, GetHeaderNames method.

Click to jump to top of pageClick to jump to parent topicSend

Syntax

Send()

Description

Use the Send method to send the email.

When you call the Send method, the following properties might be set based on the type of error:

In addition, a list of substitution strings for the error message can be accessed bythe ErrorMsgParamsCount property and the GetErrorMsgParam method.

Parameters

None.

Returns

A number indicating the status of the send. Values are:

Numeric Value

Constant Value

Description

0

%ObEmail_ FailedBeforeSending

Email failed before being sent.

1

%ObEmail_Delivered

Email was delivered.

2

%ObEmail_NotDelivered

Email delivery not attempted.

3

%ObEmail_PartiallyDelivered

Email has only been partially delivered. Only some of the addresses in the list of addresses were delivered to.

-1

%ObEmail_ SentButResultUnknown

Email was sent but whether it was successful or not is not known.

See Also

MCFOutboundEmail class: MessageNumber property, MessageSetNumber property.

InvalidAddresses, ValidSentAddresses, ValidUnsentAddresses.

Click to jump to top of pageClick to jump to parent topicSetSMTPParam

Syntax

SetSMTPParam(ParamName, ParamValue)

Description

Use the SetSMTPParam method to set parameters for the SMTP session to be used for sending the email. If you are only sending out one email, use this method. If you are sending many emails, use the SMTPSession class and set the parameters once for all the emails you are sending out.

Note. You should use this method before you use the Send method.

Parameters

ParamName

Specify the name of the parameter you want to overwrite.

ParamValue

Specify the value for the named parameter that you want used instead of the existing value.

Returns

None.

Example

&email.setSMTPParam("mail.mime.decodetext.strict", "false"); &email.setSMTPParam("mail.mime.address.strict", "false"); &email.setSMTPParam("mail.debug, "true");

See Also

SMTPSession Class

Click to jump to parent topicMCFOutboundEmail Class Properties

In this section we discuss the MCFOutboundEmail class properties. The properties are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicBackupSMTPPort

Description

Use this property to specify the port number of the backup SMTP server. This is an optional property when creating an email. If you don't specify a value, the default value is 25.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicBackupSMTPServer

Description

Use this property to specify the server name of the backup SMTP server. The system tries to connect to the backup server if the primary SMTPserver is not available.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicBackupSMTPSSLClientCertAlias

Description

Use this property to specify the alias for the certificate for Secure Sockets Layer (SSL) client authentication on the backup SMTP server.

This property is read-write.

See Also

BackupSMTPSSLPort, BackupSMTPUseSSL.

Click to jump to top of pageClick to jump to parent topicBackupSMTPSSLPort

Description

Use this property to specify the SSL port number for the backup SMTP server. This is an optional property. If you don't specify a value for this property, the default value is 465.

This property is read-write.

See Also

BackupSMTPSSLClientCertAlias, BackupSMTPUseSSL.

Click to jump to top of pageClick to jump to parent topicBackupSMTPUserName

Description

Use this property to specify the user name used to sign onto the backup SMTP server. This user name is used for authentication when sending mail using the backup mail server.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicBackupSMTPUserPassword

Description

Use this property to specify the user password used for signing onto the backup SMTP server. The BackupSMTPUserName and password are used for the authentication when sending mail using the backup mail server.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicBackupSMTPUseSSL

Description

Use this property to indicate whether the connection to the backup SMTP server will be attempted using SSL or not.

This property takes a Boolean value: true if an SSL connection is to be attempted, false if a non-SSL connection is to be attempted.

This property is read-write.

See Also

BackupSMTPSSLClientCertAlias, BackupSMTPSSLPort.

Click to jump to top of pageClick to jump to parent topicBCC

Description

Use this property to specify a comma- or semicolon-separated list of addresses that are sent a copy of this email. These blind carbon copy recipients won’t appear on the list of recipients.

This property is read-write.

See Also

MCFOutboundEmail class: CC property.

Click to jump to top of pageClick to jump to parent topicBounceTo

Description

Use this property to specify the email address the system should direct all bounced mail to.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicCC

Description

Use this property to specify a comma- or semicolon-separated list of addresses that are sent a copy (carbon copy) of this message.

This property is read-write.

See Also

MCFOutboundEmail class: BCC property.

Click to jump to top of pageClick to jump to parent topicCharset

Description

Use this property to specify the character set for the text or the attachment.

You can also specify this property using the SetAttachmentContent method, or the ContentType property.

This property is read-write.

See Also

MCFOutboundEmail class: ContentType property.

SetAttachmentContent

Click to jump to top of pageClick to jump to parent topicContentLanguage

Description

Use this property to set the language of this email. More than one language can be set in a comma-separated list. Use the standard abbreviated language names, such as en, fr, de, da, and so on.

You can also include the country codes when you specify the language, such as en-us.

This property is read-write.

See Also

http://www.w3.org/WAI/ER/IG/ert/iso639.htm

http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html

Click to jump to top of pageClick to jump to parent topicContentType

Description

Use this property to specify the content type of this body part.

You can also specify the content type with the SetAttachmentConent method.

You can also use this property to specify the character set. For example, “text/plain; charset=US-ASCII”.

This property is read-write.

See Also

MCFOutboundEmail class: Charset property.

SetAttachmentContent

Click to jump to top of pageClick to jump to parent topicDefaultCharSet

Description

Use this property to specify the character set to be applied to all the parts of the email.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicDescription

Description

Use this property to specify a description of the file attachment associated with this email. If there is no file attachment, this property is ignored.

This property is read-write.

See Also

AddAttachment

Click to jump to top of pageClick to jump to parent topicDisposition

Description

Use this property to specify how the body part is presented in the received mail.

Some email clients ignore the setting of this property and present body parts either inline or as file attachments.

Values for this property are:

Value

Description

Attachment

The body part is shown as a file attachment.

Inline

The body part is shown in the body itself.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicErrorDescription

Description

If an error occurs, use the ErrorDescription property to get the description of the error.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner. If this property has a user-specified value, that value will be overwritten automatically when there is an error condition.

See Also

MCFOutboundEmail class: ErrorDetails property.

Click to jump to top of pageClick to jump to parent topicErrorDetails

Description

If an error occurs, use the ErrorDetails property to get the details of the error.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner. If this property has a user-specified value, that value will be overwritten automatically when there is an error condition.

See Also

MCFOutboundEmail class: ErrorDescription property.

Click to jump to top of pageClick to jump to parent topicErrorMsgParamsCount

Description

Use this property to the number of substitution parameters as an integer.

This property is read-only.

See Also

MCFEmail class: GetErrorMsgParam method.

Click to jump to top of pageClick to jump to parent topicFilename

Description

If you are adding an attachment to the email, you can specify the name of the file using this property.

PeopleSoft recommends that you keep the file extension specified with this property the same as the original extension found in the file path, otherwise the client applications may not be able to display it properly.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicFilePath

Description

Specify the path for the file that contains the contents of this email.

Whether this is a relative or absolute path depends on the FilePathType property.

You can also specify a URL to the file using this property, if the FilePathType property is specified as %FilePath_Absolute.

If you specify a value for this property, the ‘Text’ content is ignored (when used with the ContentType property.)

This property is read-write.

See Also

MCFOutboundEmail class: FilePathType property.

Click to jump to top of pageClick to jump to parent topicFilePathType

Description

Use this property to specify whether the path specified with the FilePath property is a relative or absolute path. The values for this property are:

Value

Description

%FilePath_Relative

The file path specified with the FilePath property is a relative path.

%FilePath_Absolute

The file path specified with the FilePath property is either an absolute path to a file, or a URL to a file.

If you specify a relative path, the file must be available in the FILES folder of application server folder.

If you specify an absolute path, the file could be on the local machine, in any network folder, or a URL.

If you specify a value for this property, the Text property is ignored.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicFrom

Description

Use this property to specify the email address of the person sending the email.

You can specify more than one address as from in a comma-separated list.

This property is read-write.

See Also

MCFOutboundEmail class: Recipients property, ReplyTo property, Sender property.

Click to jump to top of pageClick to jump to parent topicImportance

Description

Use this property to specify the value of the importance header field.

The importance can be set to the following:

If the Priority property is not set, the system automatically sets it to the corresponding values like 5, 3 and 1.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicInvalidAddresses

Description

Use this property to get a partial list of email addresses to which the email could not be sent. The email addresses are in a string, separated by commas.

This property is read-only.

See Also

MCFOutboundEmail class: ValidUnsentAddresses property.

ValidSentAddresses

Click to jump to top of pageClick to jump to parent topicIsAuthenticationReqd

Description

Use this property to specify if authentication is required or not. If the SMTP server does not support authentication or authentication is not enabled, this property is ignored.

This property takes a Boolean value: true if authentication is required, false otherwise.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicIsOkToSendPartial

Description

Use this property to specify if the email can be sent to only some of the specified recipients or if it must be sent to all. This property takes a Boolean value: true if a partial list of addresses is acceptable, false otherwise. If the email must go out to all those listed, or to none at all, specify false.

This property is read-write.

Considerations Using IsOkToSendPartial

If the syntax of the email address is wrong, no mail is sent, regardless of the value of this property. The error is reported.

If the syntax of the email addresses is correct but the email server is unable to send mail to some addresses, the value of this property is used to either send or not send to the partial list of email addresses.

If the syntax of all the email addresses are correct and the email server is able to dispatch mail to all the addresses, no error is reported immediately. Later, if some addresses are found invalid by the recipient email server or gateway, the mail is sent back. In this case the source email server has no way to find the invalidity of the email address in advance.

Click to jump to top of pageClick to jump to parent topicIsReturnReceiptReqd

Description

Use this property to specify if the receiver must send acknowledgement that the email was received when it's received. This property takes a Boolean value: true if the return receipt is required, false otherwise.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicMessageNumber

Description

This property returns the message number of the error message associated with this email. The message number is associated with messages in the PeopleTools Message Catalog.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner. If this property has a user-specified value, that value will be overwritten automatically when there is an error condition.

See Also

MCFOutboundEmail class: MessageSetNumber property.

Click to jump to top of pageClick to jump to parent topicMessageSetNumber

Description

This property returns the message set number of the error message associated with the email.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner. If this property has a user-specified value, that value will be overwritten automatically when there is an error condition.

See Also

MCFOutboundEmail class: MessageNumber property.

Click to jump to top of pageClick to jump to parent topicMultiPart

Description

The email can contain simple text, one attachment, or a MultiPart object.

If you have assigned a MultiPart object using this property, the text and attachment related properties are ignored.

This property is read-write.

Example

Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart(); &mp.SubType = "alternative; differences=Content-type"; &mp.AddBodyPart(&text); &mp.AddBodyPart(&html); ​&email.MultiPart = &mp; ​

Click to jump to top of pageClick to jump to parent topicPriority

Description

Use this property to specify the priority of this email.

The values are:

  1. Highest Priority

  2. High Priority

  3. Normal

  4. Low Priority

  5. Lowest Priority

The default value is 3, that is, normal priority.

This value set with this property is used to set to a header X-Priority field, as this is the most common but non-standard field to show priority. In addition, the corresponding values are set in two header fields: X-MSMail-Priority and Priority. The headers X-Priority or X-MSMail-Priority are set to the corresponding value only if the user does not specify a value.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicRecipients

Description

Use this property to specify the email addresses of all the main recipients to whom the email is being sent. All the addresses are specified in a comma- or semicolon-separated string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicRefIDs

Description

Use this property to specify a value for the REFERENCES header field of the message.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicReplyIDs

Description

Use this property to specify a value for the IN-REPLY-TO header field of the message.

 

This property is read-write.

Click to jump to top of pageClick to jump to parent topicReplyTo

Description

Use this property to specify the email address where the reply should be sent. You do not need to specify a value for this property if the value is the same as the From property.

This property is read-write.

See Also

MCFOutboundEmail class: From property.

Click to jump to top of pageClick to jump to parent topicResultOfSend

Description

This property returns the result of the Send method. The values are:

Numeric Value

Constant Value

Description

0

%ObEmail_ FailedBeforeSending

Email failed before being sent.

1

%ObEmail_Delivered

Email was delivered.

2

%ObEmail_NotDelivered

Email delivery not attempted.

3

%ObEmail_PartiallyDelivered

Email has only been partially delivered. Only some of the addresses in the list of addresses were delivered to.

-1

%ObEmail_ SentButResultUnknown

Email was sent but whether it was successful or not is not known.

This property is read-only.

See Also

Send

Click to jump to top of pageClick to jump to parent topicSender

Description

Use this property to specify the address of the author of the message. You do not need to specify a value for this property if the value for the From property is the same.

This property is read-write.

See Also

MCFOutboundEmail class: From property.

Click to jump to top of pageClick to jump to parent topicSensitivity

Description

Use this property to specify the value of the sensitivity header field.

The values are:

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSMTPPort

Description

Use this property to specify the port number of SMTP server. This is an optional property. If you don't specify a value for this property, the default value is 25.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSMTPServer

Description

Use this property to specify the SMTP server to be used when sending this email.

This property is read-write.

See Also

SMTPPort, SMTPUserName, SMTPUserPassword, SMTPSession Class.

Click to jump to top of pageClick to jump to parent topicSMTPSSLClientCertAlias

Description

Use this property to specify the alias for the certificate for SSL client authentication on the SMTP server.

This property is read-write.

See Also

SMTPSSLPort, SMTPUseSSL, Using an SSL Connection to Send Email.

Click to jump to top of pageClick to jump to parent topicSMTPSSLPort

Description

Use this property to specify the SSL port number for the SMTP server. This is an optional property. If you don't specify a value for this property, the default value is 465.

This property is read-write.

See Also

SMTPSSLClientCertAlias, SMTPUseSSL, Using an SSL Connection to Send Email.

Click to jump to top of pageClick to jump to parent topicSMTPUserName

Description

Use this property to specify the user name to be used for logging into the SMTP server.

You should only use this property if the SMTP server allows authentication. If the SMTP server does not allow authentication, setting this property has no effect.

This property is read-write.

See Also

SMTPPort, SMTPServer, SMTPUserPassword.

Click to jump to top of pageClick to jump to parent topicSMTPUserPassword

Description

Use this property to specify the password for the SMTP user. This property is used with the SMTPUserName property.

This property is read-write.

See Also

SMTPPort, SMTPServer, SMTPUserName.

Click to jump to top of pageClick to jump to parent topicSMTPUseSSL

Description

Use this property to indicate whether the connection to the SMTP server will be attempted using SSL or not. If you don't specify a value for this property, the default value is N.

This property takes a Boolean value: true if an SSL connection is to be attempted, false if a non-SSL connection is to be attempted.

This property is read-write.

See Also

SMTPSSLClientCertAlias, SMTPSSLPort, Using an SSL Connection to Send Email.

Click to jump to top of pageClick to jump to parent topicStatusNotifyOptions

Description

Use this property to specify when the system should notify the sender. The values are separated by commas in a string. The values are:

Value

Description

SUCCESS

Send notification if the email is delivered successfully.

FAILURE

Send notification if the email is not delivered successfully.

DELAY

Send notification if delivery of the email is delayed.

This property is read-write.

See Also

StatusNotifyReturn, TimeToWaitForResult.

Click to jump to top of pageClick to jump to parent topicStatusNotifyReturn

Description

Use this property to specify what should be returned as the status notification. You can return either the header or the full message. This option is meaningful only if StatusNotifyOptions property is set.

The values are:

Value

Description

HDRS

Return only the headers of the email.

FULL

Return the full email message.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSubject

Description

Use this property to specify the subject of the email. A subject can only contain 254 characters.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicText

Description

Use this property to specify the text for the email.

 

This property is read-write.

Click to jump to top of pageClick to jump to parent topicTimeToWaitForResult

Description

Use this property to specify the number of milliseconds to wait for the result of send email process. If the result comes back within this time, the returned value is a positive number. Otherwise, %ObEmail_SentButResultUnknown (or -1) is returned.

This property is read-write.

See Also

StatusNotifyOptions, StatusNotifyReturn.

Click to jump to top of pageClick to jump to parent topicUsedDefaultConfig

Description

Use this property to determine whether the default configuration as specified in application server configuration file was used or not.

This property returns a Boolean value: true if the default configuration was used, false if the value specified with the MCFOutboundEmail or the SMTPSession object was used.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicUsedPrimaryServer

Description

Use this property to determine if the default SMTP server was used, or the backup server.

This property returns a Boolean value: true if the default SMTP server was used, false if the backup server was used.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicValidSentAddresses

Description

This property returns the list of addresses that were valid and that the email was sent to. The email addresses are in a string, separated by commas.

This property is read-only.

See Also

InvalidAddresses, ValidUnsentAddresses.

Click to jump to top of pageClick to jump to parent topicValidUnsentAddresses

Description

Use this property to get a list of the email addresses that are valid, yet the system was unable to send to, due to system problems. The email addresses are separated by commas.

This property is read-only.

See Also

InvalidAddresses, ValidSentAddresses.

Click to jump to parent topicSMTPSession Class

Use the SMTPSession class to when you want to send more than one email using the same SMTP session. If you are only sending a single email, use the MCFOutboundEmail class instead.

Click to jump to parent topicSMTPSession Class Methods

In this section we describe the SMTPSession class methods. The methods are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicSend

Syntax

Send(&Email)

Description

Use the Send method to send an MCFOutboundEmail object as email.

By default, the system sends the email to the SMTP server using the properties set in the application server configuration file. You can specify different setup parameters by supplying values for the SMTPSession object properties, such as Server, BackupServer, and so on.

Parameters

&Email

Specify an already instantiated MCFOutboundEMail object to be sent.

Returns

A constant indicating the status of the method. The values are:

Value

Description

%ObEmail_Delivered

The email was delivered.

%ObEmail_NotDelivered

Email delivery not attempted.

%ObEmail_PartiallyDelivered

The email was only partially delivered, that is, it was only delivered to some of the recipients.

%ObEmail_ FailedBeforeSending

The email wasn't delivered.

%ObEmail_ SentButResultUnknown

The email was sent but the result is unknown. The TimeToWaitForResult value was not sufficient to get the result of the send process.

See Also

SendAll

Click to jump to top of pageClick to jump to parent topicSendAll

Syntax

SendAll(&Emails)

Description

Use the SendAll method to send a number of emails, all using the same SMTP session and session properties.

Parameters

&Emails

Specify an array of MCFOutboundEmail objects.

Returns

An array of number. Each item in the array indicates the status of an individual email object. Values are:

Value

Description

%ObEmail_Delivered

The email was delivered.

%ObEmail_NotDelivered

Email delivery not attempted.

%ObEmail_PartiallyDelivered

The email was only partially delivered, that is, it was only delivered to some of the recipients.

%ObEmail_ FailedBeforeSending

The email wasn't delivered.

%ObEmail_ SentButResultUnknown

The email was sent but the result is unknown. The TimeToWaitForResult value was not sufficient to get the result of the send process.

See Also

SMTPSession class: Send method.

Click to jump to top of pageClick to jump to parent topicSetSMTPParam

Syntax

SetSMTPParam(ParamName, ParamValue)

Description

Use the SetSMTPParam method to set additional parameters for the SMTP session.

You must use this method before you use any Send method.

Parameters

ParamName

Specify the name of the parameter you want to overwrite.

ParamValue

Specify the value for the named parameter that you want used instead of the existing value.

Returns

None.

Click to jump to parent topicSMTPSession Class Properties

In this section we describe the SMTPSession class properties. The properties are described in alphabetical order.

Click to jump to top of pageClick to jump to parent topicBackupPort

Description

Use this property to specify the port number of backup SMTP server. This is an optional property. If you don't specify a value for this property, the default value is 25.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicBackupServer

Description

Use this property to specify the name of the backup SMTP server. The system tries connecting to the backup server if the primary SMTP server is not available.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicBackupSSLClientCertAlias

Description

Use this property to specify the alias for the certificate for SSL client authentication on the backup SMTP server.

This property is read-write.

See Also

BackupSSLPort, BackupUseSSL.

Click to jump to top of pageClick to jump to parent topicBackupSSLPort

Description

Use this property to specify the SSL port number for the backup SMTP server. This is an optional property. If you don't specify a value for this property, the default value is 465.

This property is read-write.

See Also

BackupSSLClientCertAlias, BackupUseSSL.

Click to jump to top of pageClick to jump to parent topicBackupUserName

Description

Use this property to specify the user name used to sign onto the backup SMTP server.

This user name is used for authentication when sending mail using the backup mail server.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicBackupUserPassword

Description

Use this property to specify the user password used to sign onto the backup SMTP server.

This user name and password are used for authentication when sending mail using the backup mail server.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicBackupUseSSL

Description

Use this property to indicate whether the connection to the backup SMTP server will be attempted using SSL or not.

This property takes a Boolean value: true if an SSL connection is to be attempted, false if a non-SSL connection is to be attempted.

This property is read-write.

See Also

BackupSSLClientCertAlias, BackupSSLPort.

Click to jump to top of pageClick to jump to parent topicIsAuthenticationReqd

Description

Use this property to specify if authentication is required or not. If the SMTP server does not support authentication or authentication is not enabled, this property is ignored.

This property takes a Boolean value: true if authentication is required, false otherwise.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicPort

Description

Use this property to specify the SMTP port number to be used for sending this email. This property takes a numeric value. This property is optional. If you don't specify a value for this property, the default value of 25 is used.

This property is read-write.

See Also

SMTPServer, SMTPUserName, SMTPUserPassword, SMTPSession Class.

Click to jump to top of pageClick to jump to parent topicServer

Description

Use this property to specify the name of the SMTP server to be used when sending this email.

This property is read-write.

See Also

SMTPPort, SMTPUserName, SMTPUserPassword, SMTPSession Class.

Click to jump to top of pageClick to jump to parent topicSSLClientCertAlias

Description

Use this property to specify the alias for the certificate for SSL client authentication on the SMTP server.

This property is read-write.

See Also

SSLPort, UseSSL.

Click to jump to top of pageClick to jump to parent topicSSLPort

Description

Use this property to specify the SSL port number for the SMTP server. This is an optional property. If you don't specify a value for this property, the default value is 465.

This property is read-write.

See Also

SSLClientCertAlias, UseSSL.

Click to jump to top of pageClick to jump to parent topicUsedDefaultConfig

Description

Use this property to determine whether the default configuration as specified in application server configuration file was used or not.

This property returns a Boolean value: true if the default configuration was used, false if the value specified with the MCFOutboundEmail or the SMTPSession object was used.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicUsedPrimaryServer

Description

Use this property to determine if the default SMTP server was used, or the backup server.

This property returns a Boolean value: true if the default SMTP server was used, false if the backup server was used.

This property is read-only.

Click to jump to top of pageClick to jump to parent topicUserName

Description

Use this property to specify the user name to be used for logging into the SMTP server.

You should only use this property if the SMTP server allows authentication. If the SMTP server does not allow authentication, setting this property has no effect.

This property is read-write.

See Also

SMTPPort, SMTPServer, SMTPUserPassword.

Click to jump to top of pageClick to jump to parent topicUserPassword

Description

Use this property to specify the password for the SMTP user. This property is used with the SMTPUserName property.

This property is read-write.

See Also

SMTPPort, SMTPServer, SMTPUserName.

Click to jump to top of pageClick to jump to parent topicUseSSL

Description

Use this property to indicate whether the connection to the SMTP server will be attempted using SSL or not. If you don't specify a value for this property, the default value is N.

This property takes a Boolean value: true if an SSL connection is to be attempted, false if a non-SSL connection is to be attempted.

This property is read-write.

See Also

SSLClientCertAlias, SSLPort.

Click to jump to parent topicMail Classes Examples

This section provides examples of the following:

Click to jump to top of pageClick to jump to parent topicCreating a Text Email

The following code example creates and sends a very simple email, then tests the results.

import PT_MCF_MAIL:*; /*-- Create an outbound email object --*/ Local PT_MCF_MAIL:MCFOutboundEmail &eMail = create PT_MCF_MAIL:MCFOutboundEmail(); /*-- Initialize the usual fields of an email --*/ &eMail.From = &FromAddress; &eMail.Recipients = &ToList; &eMail.Subject = &Subject; &eMail.Text = &MailBody; /*-- The send method uses the default SMTP parameters as set in the app server⇒ configuration file. This send method makes a connection to the SMTP server, sends the mail and then⇒ disconnects. The result are returned as a number corresponding to the possible values. The list of ValidSent, InvalidSent and Invalid addresses are returned in the email⇒ object itself ----*/ Local integer &resp = &eMail.Send(); Local boolean &done; Evaluate &resp When %ObEmail_Delivered /* every thing ok */ &done = True; Break; When %ObEmail_NotDelivered /*-- Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses */ &done = False; Break; When %ObEmail_PartiallyDelivered /* Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses; */ &done = True; Break; When %ObEmail_FailedBeforeSending /* Get the Message Set Number, message number; Or just get the formatted messages from &email.ErrorDescription, &email.ErrorDetails;*/ &done = False; Break; End-Evaluate;

Click to jump to top of pageClick to jump to parent topicCreating Email and Overriding SMTP Settings

The following code example creates a text email and overrides the SMTP settings as found in the application server configuration file.

import PT_MCF_MAIL:*; /*-- Create an email object by setting individual parameters ---*/ Local PT_MCF_MAIL:MCFOutboundEmail &eMail = create PT_MCF_MAIL:MCFOutboundEmail(); &eMail.Recipients = &ToList; /* comma separated list of email addresses */ &eMail.CC = &CCList; /* comma separated list of email addresses */ &eMail.BCC = &BCCList; /* comma separated list of email addresses */ &eMail.From = &FromAddress; /* from email address */ &eMail.ReplyTo = &ReplyToAddress; /* in case the reply is to be sent to a⇒ different email address */ &eMail.Sender = &SenderAddress; /* If different from the "from" address */ &eMail.Subject = &Subject; /* email subject line */ &eMail.Text = &MailBody; /* email body text */ /*-- Override the default SMTP parameters specified in app server configuration⇒ file ----*/ &eMail.SMTPServer = "psp-smtpg-01"; &eMail.SMTPPort = 10266; /*-- Usually this is 25 by default */ Local integer &resp = &eMail.Send(); /* Now check the &resp for the result */ Local boolean &done; Evaluate &resp When %ObEmail_Delivered /* every thing ok */ &done = True; Break; When %ObEmail_NotDelivered /*-- Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses */ &done = False; Break; When %ObEmail_PartiallyDelivered /* Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses; */ &done = True; Break; When %ObEmail_FailedBeforeSending /* Get the Message Set Number, message number; Or just get the formatted messages from &email.ErrorDescription, &email.ErrorDetails;*/ &done = False; Break; End-Evaluate;

Click to jump to top of pageClick to jump to parent topicCreating an HTML Email

The following example creates an HTML email.

import PT_MCF_MAIL:*; /*-- Create an email object by setting individual parameters ---*/ Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail(); &email.From = &FromAddress; &email.Recipients = &ToList; &email.Subject = &Subject; &email.Text = "<html><body><H1><b>Hi there!</b></H1><P>We are ready.</body></html>"; &email.ContentType = "text/html"; Local integer &res = &email.Send(); Local boolean &done; Evaluate &resp When %ObEmail_Delivered /* every thing ok */ &done = True; Break; When %ObEmail_NotDelivered /*-- Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses */ &done = False; Break; When %ObEmail_PartiallyDelivered /* Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses; */ &done = True; Break; When %ObEmail_FailedBeforeSending /* Get the Message Set Number, message number; Or just get the formatted messages from &email.ErrorDescription, &email.ErrorDetails;*/ &done = False; Break; End-Evaluate;

Click to jump to top of pageClick to jump to parent topicCreating a Multipart Email with Text and HTML Parts

The following code example creates an email with both HTML and text sections.

The email client on the target host must be able to detect the HTML and text parts in the email and display the part that the client is configured to display.

import PT_MCF_MAIL:*; Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail(); Local string &TestName = "Text and its alternate html body"; &email.From = &FromAddress; &email.Recipients = &ToList; &email.Subject = &Subject; Local PT_MCF_MAIL:MCFBodyPart &text = create PT_MCF_MAIL:MCFBodyPart(); &text.Text = "Hi There"; Local PT_MCF_MAIL:MCFBodyPart &html = create PT_MCF_MAIL:MCFBodyPart(); &html.Text = "<html><BODY><H1>EMail test with HTML content</H1><b>Hi There</b>" | "<A href='http://www.peoplesoft.com'>Check this out!</A>" | "<P></BODY></html>"; &html.ContentType = "text/html"; Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart(); &mp.SubType = "alternative; differences=Content-type"; &mp.AddBodyPart(&text); &mp.AddBodyPart(&html); &email.MultiPart = &mp; Local integer &res = &email.Send(); Local boolean &done; Evaluate &resp When %ObEmail_Delivered /* every thing ok */ &done = True; Break; When %ObEmail_NotDelivered /*-- Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses */ &done = False; Break; When %ObEmail_PartiallyDelivered /* Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses; */ &done = True; Break; When %ObEmail_FailedBeforeSending /* Get the Message Set Number, message number; Or just get the formatted messages from &email.ErrorDescription, &email.ErrorDetails;*/ &done = False; Break; End-Evaluate;

Click to jump to top of pageClick to jump to parent topicCreating an HTML Email with Images

The following code example creates an HTML email with embedded images. The content ID for an image can be a reference to a part in the email. In the following code example, the images become a part of the email and are transmitted as attachments to the email.

import PT_MCF_MAIL:*; Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail(); &email.From = &FromAddress; &email.Recipients = &ToList; &email.Subject = &Subject; Local string &htmlText = "<html>" | " <head><title></title></head>" | " <body>" | " <b>A sample jpg</b><br>" | " <IMG SRC=cid:23abc@pc27 width=566 height=424><br>" | " <b>End of jpg</b>" | " </body>" | "</html>"; /* In this sample, the htmlText is assembled using | operator only for the readability. Specifying just one string can be more efficient */ Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart(); &mp.SubType = "related"; Local PT_MCF_MAIL:MCFBodyPart &html = create PT_MCF_MAIL:MCFBodyPart(); &html.Text = &htmlText; &html.ContentType = "text/html"; Local PT_MCF_MAIL:MCFBodyPart &image = create PT_MCF_MAIL:MCFBodyPart(); &image.SetAttachmentContent("///file:C:/User/Documentum/XML%20Applications/proddoc⇒ /peoplebook_upc/peoplebook_upc.dtd", %FilePath_Absolute, "sample.jpg", "This is a sample image!", "", ""); &image.AddHeader("Content-ID", "<23abc@pc27>"); &mp.AddBodyPart(&html); &mp.AddBodyPart(&image); &email.MultiPart = &mp; Local integer &res = &email.Send(); Local boolean &done; Evaluate &resp When %ObEmail_Delivered /* every thing ok */ &done = True; Break; When %ObEmail_NotDelivered /*-- Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses */ &done = False; Break; When %ObEmail_PartiallyDelivered /* Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses; */ &done = True; Break; When %ObEmail_FailedBeforeSending /* Get the Message Set Number, message number; Or just get the formatted messages from &email.ErrorDescription, &email.ErrorDetails;*/ &done = False; Break; End-Evaluate;

Click to jump to top of pageClick to jump to parent topicCreating an Email from Rich Text Editor Output

The following example creates an email message using output from a long edit box enabled with the rich text editor. Using the ParseRichTextHtml method, rich text output of the long edit box is split into an array of MCFBodyPart objects.

import PT_MCF_MAIL:*; Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail(); Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart(); Local PT_MCF_MAIL:MCFMailUtil &mu = create PT_MCF_MAIL:MCFMailUtil(); Local string &htmlText = RECORD_NAME.FIELD_NAME.Value; &mp.SubType = "related"; &email.Recipients = &recipients; &email.From = &from; &email.Subject = "Your Order"; Local array of PT_MCF_MAIL:MCFBodyPart &bp; &mu.imagesLocation = "c:\temp\images"; &bp = &mu.ParseRichTextHtml(&htmlText); If (&bp = Null) Then MessageBox(0, "", 0, 0, &mu.ErrorDescription); Return; End-If; &mp.AddBodyPart(&bp [1]); For &i = 2 To &bp.Len &mp.AddBodyPart(&bp [&i]); End-For; &email.MultiPart = &mp; Local integer &resp = &email.Send(); /* Exec code to check the &resp for the result */ /* Exec code to delete temporary image files from the imagesLocation directory */

For example, the rich text editor is used to create a message containing text and two images as shown in this example:

The HTML for this email is as follows:

<p>Dear Customer,</p> <p>Here are the details of your order:</p> <ul> <li> Item #1 - Ocean Sunset: <br /> <img height="180" id="PT_RTE_IMG_DB_LOC###20091111142435187⇒ Sunset_thumbnail.jpg" src="/cs/QEDMO/cache/PTRTDB_JPG_GIYDAOJRGEYT⇒ CMJUGI1DGNJRHA2VG4LOONSXIX2UNB1W1YTOMFUWYLTKOBTQ=_GA==_GE==_2000000000.⇒ JPG" width="240" /><br /> &nbsp;</li> <li> Item #2 - Hazy Blue Mountains: <br /> <img height="180" id="PT_RTE_IMG_DB_LOC###20091111142508395⇒ Mountains_thumbnail.jpg" src="/cs/QEDMO/cache/PTRTDB_JPG_GIYDAOJRGEYTCM⇒ JUGI1TAOBTHE1U122VNZ1GC1LOONPXI1DVNVRG3YLJNQXGU3DH_GA==_GE==_2000000000.⇒ JPG" width="240" /></li> </ul> <p>Thank you and regards,</p> <p>Customer Service Department <br /><a href="http://www.xyzcorp.com">http://www.xyzcorp.com</a></p>

When this HTML is parsed by the ParseRichTextHtml method, an array with three MCFBodyPart elements is created. The first MCFBodyPart is array element &bp [1] with the following properties:

The second MCFBodyPart is array element &bp [2] with the following properties:

The final MCFBodyPart is array element &bp [3] with the following properties:

Observe that the email received by the recipient is formatted the way that it appeared in the rich text editor as shown in the following example:

Finally, the XML code that represents this email message is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:⇒ cms="http://cms.ocs.oracle/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/⇒ envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <cms:GetEntitySnapshotResponse> <return xsi:type="EmailMessageType_DEBUG" SnapshotId="00000000000000010⇒ 00009E2607E2B4200000124E528DD580000000000000001" CEN="334B:3BF0:emsg:⇒ 38893C00F42F38A1E0404498C8A6612B0000FEE32642"> <CreatedOn>2009-11-11T21:31:07Z</CreatedOn> <Creator EID="334B:3BF0:user:CB3F97695BD24114B65149D2E4CC842E0000000⇒ 112AE"/> <Deleted>false</Deleted> <ModifiedBy EID="334B:3BF0:user:CB3F97695BD24114B65149D2E4CC842E0000⇒ 000112AE"/> <ModifiedOn>2009-11-11T21:31:07Z</ModifiedOn> <Name>your order</Name> <Parent EID="334B:3BF0:afrh:38893C00F42F38A1E0404498C8A6612B00001EF9⇒ C00A"/> <New>false</New> <ReadFlag>true</ReadFlag> <UserCreatedOn>2009-11-11T21:31:06Z</UserCreatedOn> <Viewer EID="334B:3BF0:user:CB3F97695BD24114B65149D2E4CC842E00000001⇒ 12AE"/> <Content> <ContentId>24316678.11257950022359.JavaMail.admin@XXXXX</ContentId> <MediaType>message/rfc822</MediaType> <Body xsi:type="MultiContentType"> <MediaType>multipart/related</MediaType> <Parts> <Item xsi:type="SimpleContentType"> <MediaType>text/html</MediaType> <CharacterEncoding>us-ascii</CharacterEncoding> <Language>en</Language> <ContentStream> <Id>T0RNMU5ESTFOVFpEUmtKQ05FWTJNemhETmpWQ1JqWXdRel⇒ ZDT0VJek9EUXdNREF3TURBd01EWTVRVUU9JCQjIyQkN2JpdCQkIyMkJDg3NyQkIyMkJDU2Mg==</Id> <Length>640</Length> </ContentStream> </Item> <Item xsi:type="SimpleContentType"> <Disposition>INLINE</Disposition> <ContentId>&lt;2205@pc27&gt;</ContentId> <MediaType>image/gif</MediaType> <CharacterEncoding>ascii</CharacterEncoding> <Language>en</Language> <ContentStream> <Id>T0RNMU5ESTFOVFpEUmtKQ05FWTJNemhETmpWQ1JqWXdRelZD⇒ T0VJek9EUXdNREF3TURBd01EWTVRVUU9JCQjIyQkYmFzZTY0JCQjIyQkMTY3NCQkIyMkJDExNzI4</Id> <Length>11923</Length> </ContentStream> <Name>20091111142435187Sunset_thumbnail.jpg</Name> </Item> <Item xsi:type="SimpleContentType"> <Disposition>INLINE</Disposition> <ContentId>&lt;8160@pc27&gt;</ContentId> <MediaType>image/gif</MediaType> <CharacterEncoding>ascii</CharacterEncoding> <Language>en</Language> <ContentStream> <Id>T0RNMU5ESTFOVFpEUmtKQ05FWTJNemhETmpWQ1JqWXdRelZD⇒ T0VJek9EUXdNREF3TURBd01EWTVRVUU9JCQjIyQkYmFzZTY0JCQjIyQkMTM2NDMkJCMjJCQ3MzUy</Id> <Length>7553</Length> </ContentStream> <Name>20091111142508395Mountains_thumbnail.jpg</Name> </Item> </Parts> </Body> <From> <Address>&lt;psft@peoplesoft.com&gt;</Address> </From> <Priority>NONE</Priority> <Sender> <Address>&lt;psft@peoplesoft.com&gt;</Address> </Sender> <SentDate>2009-11-11T21:31:06Z</SentDate> <Size>21039</Size> <Subject>Your Order</Subject> <TOReceivers> <Item> <Address>&lt;&gt;</Address> <Participant EID="334B:3BF0:user:CB3F97695BD24114B65149D2E4⇒ CC842E0000000112AE"/> <Directives/> <Status>DELIVERED</Status> </Item> </TOReceivers> </Content> <DeliveredTime> <DateOnly>false</DateOnly> <FloatingTime>false</FloatingTime> <Timestamp>2009-11-11T21:31:07Z</Timestamp> </DeliveredTime> <Modifiable>false</Modifiable> <ReceiptRequested>false</ReceiptRequested> <Type>EMAIL</Type> <MimeHeaders> <Item> <Name>X-AUTH-TYPE</Name> <Value>SW50ZXJuYWwgSVA=</Value> </Item> <Item> <Name>Received</Name> <Value>ZnJvbSByZ21pbmV0MTMub3JhY2xlLmNvbSAoLzE0OC44Ny4xM⇒ TMuMTI1KSBieSBkZWZhdWx0IChPcmFjbGUgQmVlaGl2ZSBHYXRld2F5IHY0LjApIHdpdGggRVNN⇒ VFAgOyBXZWQsIDExIE5vdiAyMDA5IDEzOjMxOjA2IC0wODAw</Value> </Item> <Item> <Name>Received</Name> <Value>ZnJvbSBCVUZGWSAoYnVmZnkudXMub3JhY2xlLmNvbSBbMTAuMTM4L⇒ jIyOC4xMzNdKSBieSByZ21pbmV0MTMub3JhY2xlLmNvbSAoU3dpdGNoLTMuMy4xL1N3aXRjaC0⇒ zLjMuMSkgd2l0aCBFU01UUCBpZCBuQUJMVjZVSjAxMzk0NiBmb3IgPGRhdmUucGllcmNlQG9yYWNsZ⇒ S5jb20+OyBXZWQsIDExIE5vdiAyMDA5IDIxOjMxOjA2IEdNVA==</Value> </Item> <Item> <Name>MIME-Version</Name> <Value>MS4w</Value> </Item> <Item> <Name>To</Name> <Value>ZGF2ZS5waWVyY2VAb3JhY2xlLmNvbQ==</Value> </Item> <Item> <Name>MESSAGE-ID</Name> <Value>PDI0MzE2Njc4LjExMjU3OTUwMDIyMzU5LkphdmFNYWlsLmFkb⇒ WluQEJVRkZZPg==</Value> </Item> <Item> <Name>Content-Type</Name> <Value>bXVsdGlwYXJ0L3JlbGF0ZWQ7ICBib3VuZGFyeT0iLS0tLT1fUGFyd⇒ F8xXzIzNzUyMTguMTI1Nzk1MDAyMjEwOSI=</Value> </Item> <Item> <Name>From</Name> <Value>cHNmdEBwZW9wbGVzb2Z0LmNvbQ==</Value> </Item> <Item> <Name>X-SOURCE-IP</Name> <Value>YnVmZnkudXMub3JhY2xlLmNvbSBbMTAuMTM4LjIyOC4xMzNd</Value> </Item> <Item> <Name>X-CT-REFID</Name> <Value>c3RyPTAwMDEuMEEwOTAyMDQuNEFGQjJEMTkuMDBGQSxzcz0xLGZncz⇒ 0w</Value> </Item> <Item> <Name>Subject</Name> <Value>WW91ciBPcmRlcg==</Value> </Item> <Item> <Name>Date</Name> <Value>V2VkLCAxMSBOb3YgMjAwOSAyMTozMTowNiBHTVQ=</Value> </Item> </MimeHeaders> </return> </cms:GetEntitySnapshotResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

Click to jump to top of pageClick to jump to parent topicCreating an Email with Attachments

The following code example creates an email with an attachment.

PeopleSoft recommends that you always provide the proper extension in the file name, otherwise the receiving email client may not be able to associate it with the appropriate application.

Note. There is no automatic restriction of attachment size using the mail classes. To restrict an email based on attachment size, your application must check the size of an attachment before composing and sending the email.

import PT_MCF_MAIL:*; Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail(); &email.From = &FromAddress; &email.Recipients = &ToList; &email.Subject = &Subject; Local string &plain_text = "Hi there!"; Local PT_MCF_MAIL:MCFBodyPart &text = create PT_MCF_MAIL:MCFBodyPart(); &text.Text = &plain_text; Local PT_MCF_MAIL:MCFBodyPart &attach1 = create PT_MCF_MAIL:MCFBodyPart(); &attach1.SetAttachmentContent("Ocean Wave.jpg", %FilePath_Relative, "Ocean Wave.jpg", "Ocean Wave", "", ""); /* %FilePath_Relative indicates the file is available at Appserver's FILES⇒ dierctory */ Local PT_MCF_MAIL:MCFBodyPart &attach2 = create PT_MCF_MAIL:MCFBodyPart(); &attach2.SetAttachmentContent("///file:C:/User/Documentum/XML%20Applications⇒ /proddoc/peoplebook_upc/peoplebook_upc.dtd", %FilePath_Absolute, "Sample.jpg", "Sample", "", ""); /* The Sample.jpg is available in the "public" folder of my-server machine*/ Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart(); &mp.AddBodyPart(&text); &mp.AddBodyPart(&attach1); &mp.AddBodyPart(&attach2); &email.MultiPart = &mp; Local integer &res = &email.Send(); Local boolean &done; Evaluate &resp When %ObEmail_Delivered /* every thing ok */ &done = True; Break; When %ObEmail_NotDelivered /*-- Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses */ &done = False; Break; When %ObEmail_PartiallyDelivered /* Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses; */ &done = True; Break; When %ObEmail_FailedBeforeSending /* Get the Message Set Number, message number; Or just get the formatted messages from &email.ErrorDescription, &email.ErrorDetails;*/ &done = False; Break; End-Evaluate;

Click to jump to top of pageClick to jump to parent topicCreating Email Attachments by Specifying URLs

The following code example creates an email attachment specifying a URL for the file location, instead of an absolute or relative path to the file.

Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail(); &email.From = &FromAddress; &email.Recipients = &ToList; &email.Subject = &Subject; Local string &plain_text = "Hi there!"; Local PT_MCF_MAIL:MCFBodyPart &text = create PT_MCF_MAIL:MCFBodyPart(); &text.Text = &plain_text; Local PT_MCF_MAIL:MCFBodyPart &attach1 = create PT_MCF_MAIL:MCFBodyPart(); &attach1.SetAttachmentContent("http://www.yahoo.com/members_agreement", %FilePath_Absolute, "hotmail.htm", "Hotmail Home page", "", ""); Local PT_MCF_MAIL:MCFBodyPart &attach2 = create PT_MCF_MAIL:MCFBodyPart(); &attach2.SetAttachmentContent("ftp://www.w3c/docs/somedoc", %FilePath_Absolute, "somedoc.htm", "somedoc from w3c", "", ""); Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart(); &mp.AddBodyPart(&text); &mp.AddBodyPart(&attach1); &mp.AddBodyPart(&attach2); &email.MultiPart = &mp; Local integer &res = &email.Send(); Local boolean &done; Evaluate &resp When %ObEmail_Delivered /* every thing ok */ &done = True; Break; When %ObEmail_NotDelivered /*-- Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses */ &done = False; Break; When %ObEmail_PartiallyDelivered /* Check &email.InvalidAddresses, &email.ValidSentAddresses and &email.ValidUnsentAddresses; */ &done = True; Break; When %ObEmail_FailedBeforeSending /* Get the Message Set Number, message number; Or just get the formatted messages from &email.ErrorDescription, &email.ErrorDetails;*/ &done = False; Break; End-Evaluate;

Click to jump to top of pageClick to jump to parent topicCreating and Sending Multiple Email Messages

You can create several emails and send them all in a single connection to the SMTP server. However, your system administrator may also need to configure the SMTP server with longer connection time-outs if you are sending multiple emails.

import PT_MCF_MAIL:*; /*-- Create an email object by setting individual parameters ---*/ Local array of PT_MCF_MAIL:MCFOutboundEmail &mails; Local PT_MCF_MAIL:MCFOutboundEmail &email; Local PT_MCF_MAIL:SMTPSession &commonSession = create PT_MCF_MAIL:SMTPSession(); &email = &commonSession.CreateOutboundEmail(); &email.From = &FromAddress; &email.Recipients = &ToList1; &email.Subject = &Subject; &email.Text = &MailBody1; &mails = CreateArray(&email); &email = &commonSession.CreateOutboundEmail(); &email.From = &FromAddress; &email.Recipients = &ToList2; &email.Subject = &Subject; &email.Text = &MailBody2; &mails [2] = &email; &email = &commonSession.CreateOutboundEmail(); &email.From = &FromAddress; &email.Recipients = &ToList3; &email.Subject = &Subject; &email.Text = &MailBody3; &mails [3] = &email; Local array of integer &allRes = &commonSession.SendAll(&mails);

Click to jump to top of pageClick to jump to parent topicSending an Email With Authentication

The following code example includes a user name and password to be used by the SMTP server.

import PT_MCF_MAIL:*; Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail(); &email.From = &FromAddress; &email.Recipients = &ToList; &email.Subject = &Subject; &email.Text = &MailBody; &email.SMTPServer = "MySMTPServer"; &email.IsAuthenticationReqd = True; &email.SMTPUserName = "SomeLoginName"; &email.SMTPUserPassword = "SomeLoginPassword"; Local integer &res = &email.Send();

Click to jump to top of pageClick to jump to parent topicUsing an SSL Connection to Send Email

The following code example uses an SSL connection to send an email message:

import PT_MCF_MAIL:*; Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail(); &email.From = &FromAddress; &email.Recipients = &ToList; &email.Subject = &Subject; &email.Text = &MailBody; &email.SMTPServer = "MySMTPServer"; &email.IsAuthenticationReqd = True; &email.SMTPUserName = "SomeLoginName"; &email.SMTPUserPassword = "SomeLoginPassword"; &email.SMTPUseSSL = "Y"; &email.SMTPSSLClientCertAlias = &cAlias; &email.SMTPSSLPort = &SSLPort; Local integer &res = &email.Send();