MailRead
Reads a standard mail message. The mail message can contain text, an attached file, or both.
Before you can use this function, you need to use the MailLogon() function to log on to the mail system. You can only read mail sent to the user name specified in the MailLogon() function.
Syntax
MailRead(sName, sSubject, sNote, sFileName, iMode)
sName:
The name of the mail user who sent the message.
sSubject:
The subject text of the mail message.
sNote:
The note section of the message. If the message is longer than 255 characters, CitectSCADA will save the message in a file and return the file name in sNote. Use the file functions to read the message. The name of the file will be in the form CTxxxxx where x is a unique number. You need to delete the file after you have finished with the mail message.
sFileName:
The name of any attached file. If there is no attached file in the message, specify sFileName as an empty string "".
iMode:
The mode of the read:
0 - Read a message. If no message is available, wait for a message.
1 - Read a message. If no message is available, return with an error code.
Return Value
0 (zero) if successful, otherwise an error is returned.
Related Functions
MailLogon, MailLogoff, MailSend, MailError
Example
! Logon to the mail system
MailLogon("RodgerG", "password", 0);
! Read a message. Don't wait if no message
IF MailRead(sName, sSubject, sNote, sFileName, 1) = 0 THEN
! got message now do something with it
END
WHILE TRUE DO
! wait for a mail message
MailRead(sName, sSubject, sNote, sFileName, 0);
END;
MailLogoff();
See Also