Salesforce

How Do I Receive an Email? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Receive an Email? (Magic xpa 3.x)

When you receive email, there are several steps.

  1. To receive mail, you need to use a POP3 or IMAP connection (rather than the SMTP connection that is used for sending). This connection will probably require a user ID and password, so your login might be something like:

MailConnect (3,'juno.olympus.com','FredZ','rabbit16')

Here the ‘3’ is the connection type, to connect to an IMAP server, and the other three parameters are the server name, user name, and password.

  1. The return code, if positive, will indicate the number of emails in the queue. Save that number!

  2. Now, you need to cycle through those messages. You will cycle until the index is equal to the number of messages. For each message, you can use the various functions to fetch the different pieces of the email. For instance, suppose Y is the index. Then you could fetch:

    MailMsgDate(Y)

    MailMsgFrom(Y)

    MailMsgSubj(Y)

    MailMsgText(Y)

    MailMsgFiles(Y)

    You can save all these in your own email system, if you want.

    When you have successfully read a message, you can use

    MailMsgDel(Y)

    If you don’t delete the messages, they will stay in your mailbox. (Keeping them in the mailbox is a great idea when you are testing).

  3. And when you are finished, you can use

    MailDisconnect(2, ‘TRUE’LOG)

    to disconnect your session and delete mail from the server. The ‘2’ is the disconnect type, to disconnect from the mail “receive” server. The ‘TRUE’LOG boolean is a parameter that forces the deletion of mail on the server.

A note on server types

There are two types of servers that are used to download mail, and they work slightly differently. When you connect to a POP3 mail server, only the new messages are received. But when you connect to an IMAP server, you will receive all existing messages, both the new ones and the ones that were previously downloaded.

See also

Detailed information on each of these functions is found in the Magic xpa Help system.

The Online and Rich Client Samples projects (program EL03 and REL03)

Reference
Attachment 
Attachment