ScriptPro Editor This topic is for use by scriptwriters who are using ScriptPro Editor to create custom scripts for their agencies. Agents can go to Using ScriptPro Scripts for more information about using custom or standard scripts within Travelport Smartpoint. |
Additional Mail Command Examples
The script excerpts below provide additional examples of selected mail commands.
MAILDELETE/MAILDATE/MAILFIND
VARIABLES
RET_CODE = 0 |
|
MessageID = "" |
// the mail message identifier |
bRead = 0 |
// has the mail been read flag |
SendDate = '00/00/00' |
// the date the mail was sent |
TodayDate = '00/00/00' |
// today's date |
DiffDays = 0 |
// the difference between today's date and the mail's date |
ROUTINES
BEGIN
// get today's date
TODAY( TodayDate )
// get the first piece of mail
MAILFIND( "", MM_ALL, MM_ALL, MessageID, bRead, RET_CODE )
WHILE ( RET_CODE == 1 ) DO
IF ( bRead == 1 ) THEN // if the mail was read
MAILDATE( MessageID, SendDate, RET_CODE ) // get the mails date
DiffDays = TodayDate - SendDate // find the number of days
IF ( DiffDays > 5 ) THEN // if mail is 6 days old
MAILDELETE( MessageID, RET_CODE ) // delete the mail
ENDIF
ENDIF
// get the next piece of mail
MAILFIND( "", MM_ALL, MM_ALL, MessageID, bRead, RET_CODE )
ENDWHILE
END
MAILWAIT/MAILREAD/MAILADDRESS/MAILSEND
VARIABLES
RET_CODE = 0 |
|
MessageID = "" |
// the mail message identifier |
AddressList = "" |
// the address list |
From = "" |
|
MyText = "" |
|
Attachments = "" |
|
OldSubject = "" |
|
MySubject = "RE:" |
|
ROUTINES
BEGIN
// wait until some unread mail is found
MAILWAIT( MessageID )
// read the mail
MAILREAD( MessageID, From, AddressList, OldSubject, MyText, Attachments,
RET_CODE )
IF ( RET_CODE == 1 ) THEN
MySubject = MySubject + OldSubject // build reply subject
MyText = MyText + " ***Reply from Ron Zepp*** : " // build reply text
MAILADDRESS( AddressList, RET_CODE ) // update address list
// send the reply
MAILSEND( AddressList, MySubject, MyText, "", TRUE, RET_CODE )
ENDIF
END