EMAIL operator
The EMAIL operator creates an action that sends email.
Syntax
EMAIL [FROM fromExpr]
[SUBJECT subjExpr]
recipientType1 recipientExpr1
...
recipientTypeN recipientExprN
[BODY bodyExpr]
ATTACH attachFileExpr1 [NAME attachNameExpr1]
...
ATTACH attachFileExprM [NAME attachNameExprM]
Description
The EMAIL operator creates an action that sends emails.
It is assumed that the file extension is not specified in the attachment name, i.e. period . is also considered part of the file name. This extension is automatically determined similar to the WRITE operator.
Parameters
-
fromExprAn expression which value determines the sender address.
-
subjExprAn expression which value determines the email subject.
-
recipientType1 ... recipientTypeNRecipient types. N>=1. Each of them is specified by one of the keywords:
TO- message recipientСС- secondary message recipient to whom a copy is sentBCC- message recipient whose address is not shown to other recipients
-
recipientExpr1 ... recipientExprNExpressions which values determine the addresses of the message recipients.
-
bodyExprAn expression which value is the mail body. Can be either a string or file type.
-
attachFileExpr1 .... attachFileExprMExpressions which values are files attached to the message.
-
attachNameExpr1 ... attachNameExprMAn expression which values determine the names of the attachments.
Example
FORM remindUserPass
OBJECTS u=CustomUser PANEL
PROPERTIES(u) READONLY login, name[Contact]
;
emailUserPassUser 'Login reminder' (CustomUser user) {
LOCAL bodyFile = FILE ();
PRINT remindUserPass OBJECTS u = user HTML TO bodyFile;
EMAIL
SUBJECT 'Login reminder'
TO email(user)
BODY bodyFile();
}
justSendEmail 'Send letter' () {
stringToFile('<font color=#FF0000 size=+3>big red text</font>');
EMAIL
FROM 'luxsoft@adsl.by'
SUBJECT 'Letter subject'
TO 'xxx@tut.by'
BODY resultFile();
}