MCFGetMail Class Methods

This section discusses MCFGetMail class methods.

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.

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.

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

Field or Control

Definition

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);

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

Field or Control

Definition

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);

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

Field or Control

Definition

Count

Specify the number of emails you want to read.

Returns

An array of MCFInboundEmail.

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

Field or Control

Definition

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);

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

Field or Control

Definition

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.

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

Field or Control

Definition

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);

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.

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

Field or Control

Definition

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 deleted, 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;

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

Field or Control

Definition

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.

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

Field or Control

Definition

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.