EMAIL(1,2,3,4,5,6,7,8,9)
PURPOSE
Use this function to send or receive email messages from your SMTP (send) server or POP3 (receive) server. Also this function support MAPI for (send only)
PARTS
1 sac | Required - What to do: |
emlRecvSignOn - Tell the program to sign on to your POP3 server so that you can receive email messages.
emlRecvSignOff - When you're finished receiving email messages you must sign off.
emlRecvMsgList - Receive three lines for each outstanding email. This would consist of the sender, subject and date-time.
emlRecvMsg - Receive a specific email message. You must do this before you can get the individual parts.
emlRecvMsgBody - Move the body lines of a previously received email message into a string list.
emlRecvMsgAttach - Save the attachments to disk and put the file names into a string list.
emlRecvMsgCC - Move the Carbon Copy recipients (name and email addresses) to a string list.
emlRecvMsgCount - Get the number of outstanding emails currently on the server.
emlRecvMsgDel - Mark a specific email number for deletion. NOTE: This won't take place until you log out from the server.
emlSendMsg - Send an email message.
emlSendIMAP - Send an email Message Through Default IMAP (Mail Application Program interface)Application. Allows you to directly use programs like outlook and outlook express to send your email from TAS Professional powered by CAS letting the user even use there own email address book.
2 f/c/e | Several of the email operations above expect to have a TStringList object available on the form to either store information received or for the information you want to send. This object can be part of a visual object, such as a TMemo, TTASComboBox, etc, or can be a TTASStrList. This object is required for: emlRecvMsgList, emlRecvMsg.Body, emlRecvMsgAttach, emlRecvMsgCC and emlSendMsg. For these options this would be the object name. |
For emlRecvMsg and emlRecvMsgDel this is the required email message number. This value would be between 1 and the value received for the emlRecvMsgCount option, inclusive.
3 f/c/e | For the options in part 2 that require a TStringList object, this is the required name of the property, for example, "Lines" in TMemo, "Items" in TTASComboBox and "Lines" in a TTASStrList. |
4 f/c/e | emlRecvMsgAttach - Required - This is the path where you want the attachments to be saved. |
emlSendMAPI - Boolean to bring up Default Emailer Send Dialog.(Default False) Note: To use target email compose dialog set this to true.
5 f/c/e | If you want to override the value for the server name to be used in the emlRecvSignOn or emlSendMsg operation, you can put that value here. If there is no value here the program will use value entered in the setup program for POP3 Server (emlRecvSignOn) or SMTP Server (emlSendMsg). |
emlSendIMAP - Sender Address (optional)
6 f/c/e | If you want to override the value for the password to be used in the emlRecvSignOn or emlSendMsg operation, you can put that value here. If there is no value here the program will use value entered in the setup program for POP3 Password (Recv) or the SMTP Password (Send). |
emlSendMAPI - Sender Name (optional)
7 f/c/e | If you want to override the value for the user name to be used in the emlRecvSignOn or emlSendMsg operation, you can put that value here. If there is no value here the program will use value entered in the setup program for POP3 UserName (Recv) or the SMTP UserName (Send). |
8 f/c/e | If you want to override the value for the sender address to be used in the emlSendMsg operation, you can put that value here. If there is no value here the program will use value entered in the setup program for Email Address. |
9 f/c/e | If you want to override the value for the sender name to be used in the emlSendMsg operation, you can put that value here. If there is no value here the program will use value entered in the setup program for Name (sender name). |
RETURN TYPE - Varies
The return value depends on the option set in part 1.
emlRecvSignOn - L - Returns True if the sign on process is successful and False if not.
emlRecvSignOff - L - Returns True if the sign off process is successful and False if not.
emlRecvMsgList - I - Returns the number of email messages. This would also be the number of lines added to the TStringList object.
emlRecvMsg - L - If the message is received properly this returns True, if not False.
emlRecvMsgBody - I - Returns the number of lines in the email message body. This would also be the number of lines added to the TStringList object.
emlRecvMsgAttach - I - Returns the number of attachments in the email. This would also be the number of lines added to the TStringList object and the number of files saved to disk.
emlRecvMsgCC - I - Returns the number of carbon copy recipients in the email. This would also be the number of lines added to the TStringList object.
emlRecvMsgCount - I - This is similar to emlRecvMsgList except only the number of outstanding emails is returned.
emlRecvMsgDel - L - If you specify an email message number within those available this will return True, if not it will return False.
emlSendMsg - L - If the email is setup properly and it is sent this will return True, otherwise it will return False.
emlSendIMAP - L - If the email is setup properly and it is sent this will return True, otherwise it will return False.
COMMENTS
NOTE: The special alpha constants above (emlRecvSignOn through emlSendMsg) are defined in COMPILERCONSTANTS.TXT.
NOTE: You must setup the email server information before you can send and receive emails. For more information please see Email Settings in the Set Configuration section.
NOTE: For emlSendIMAP Does not Require any configuration in TASPRO. You May need to change some Security Setings in your Default EMailer.
NOTE: You must be signed on to your ISP or intranet before attempting an email operation. This function will not make the connection automatically.
EXAMPLES
A program is included with TAS Professional, EMAILTEST, that will allow you to receive and send email. This is a very simple program, but it will give you an idea of the power of this option. When you run this program the following screen will be displayed:
The first step to receiving emails is to Logon to your POP3 server. Do that by clicking on the Logon button. Once you do the receive buttons will be enabled and the send buttons disabled.
To receive a list of outstanding email click on the Recv Msg List button. Notice that the message list is split into three lines; the first is the name <address> of the sender, the second the subject line and the third the date and time the message was sent.
To display the body of the message enter the message number in the field after Recv Attach and click on the Recv Msg button.
To receive any attachments for the message again, put the message number in the field and click on Recv Attach. If there are no attachments that will be displayed in the memo.
Messages that you want to send have a specific structure. You need to include a TStrings or TStringsList object that includes the following lines, as appropriate:
\TO
followed by the address and name of the receiver(s) in address,name format. You can have as many receivers as you wish, however, you must have at least one.
\CC
Similar to receiver(s) above, except these will be added to the Carbon Copy list.
\BCC
Similar to CC above except the receiver(s) won't know who's on the list since they are Blind Carbon Copies.
\Subject
The subject of the email. A single line only.
\Body
As many lines as you wish. This makes up the body of the email.
\Attachments
The files you wish to attach to this email. You must include the full file name and path. If the file is not found it will not be sent. So, an example of an attachment file name would be: c:\temp\datetest.jpg.
An example of a message is part of the program. Make sure you have logged off the POP3 server (Logoff button) and click on the Demo Msg button. The following will appear:
Notice that case doesn't matter in the control lines. However, the first character must be a back slash and the exact word must immediately follow. Further, there can be nothing else on the control line.
If you wish to separater sections with a blank line you may. Blank lines are ignored in the \TO, \CC, \BCC, \SUBJECT and \ATTACHMENT section. However, they are included in the \BODY.
NOTE: It is a good idea to always logoff the server before you exit the program. In this example that process is done for you.
Page url: http://www.cassoftware.com/tas/manual/emailoperations().htm