|
This macro is used to send emails.
Parameter
|
Description |
| SMTP |
SMTP server name or IP address. (String or Variable that contains the server name) |
| Usr |
SMTP user name. (String or Variable that contains the user name) |
| Pw |
SMTP password. (String or Variable that contains the password) |
| From |
From email. (String or Variable that contains the email) |
| To |
List of the emails that will receive the message, it could be a string or variable that contains one or more emails separated by ";" or one variable that contains one array of emails. |
| Subject |
Message subject. (String or Variable that contains the subject) |
| Message |
Message body. (String or Variable that contains the message) |
| Mens_Type |
Message format: (T)ext or (H)tml. |
| Copies |
List of the emails that will receive the message, it could be a string or variable that contains one or more emails separated by ";" or one variable that contains one array of emails. |
| Copies_Type |
Type copies: BCC (Hidden copies) or CCC (Regular copies). |
| Port |
The port used by your e-mail server. Use the port 465 for the security type SSL, and the port 587 for the security type TLS or the port 25 for no security. If not informed, Scriptcase will set the default port: 25 |
| Connection_Type |
Indicating a secure connection. Use S for SSL, T for TLS or N for non secure connections. If not informed, Scriptcase will set the default value:N. |
| Attachment |
Absolute path of the file that will be attached in the email |
| SSL |
Optional parameter to add SSL settings. If you need to add more than one setting, use ";" for separate them. Ex: $ssl = 'allow_self_signed=false;verify_peer=false'; |
| Reply_to |
It is the email address the reply message is sent to, when you want the reply to go to an email address other than the From address. |
Note: To use safe connection its required to have the PHP "php_openssl" extension enable.
Ex. 1: Sending e-mail with reply_to parameter sc_mail_send('smtp.meuserver.com.br', 'usr', 'pw', 'from@netmake.com.br', 'to@netmake.com.br', 'test sending of e-mail', 'message', 'H', 'abc@cop.com.br;zxy@cop.com.br', 'CCC', '587', '', 'c:/teste/arq .txt','','reply@netmake.com.br');
To use the replay_to parameter you must include all the other parameters before it, just inform them empty.
Ex. 2: Using variables and defining the port. sc_mail_send([glo_smtp], [usuar], [glo_pw], {from}, {to}, {subject}, {message}, 'T', [glo_copias], 'CCC', '419', 'S', {attached});
Ex. 3: No user and password. sc_mail_send([glo_smtp], '', '', 'from.netmake.com.br', {to}, {subject}, {message}, 'H', '', '', '', '', [glo_att]);
The amount of emails sent will be stored at the special variable "sc_mail_count".
If any error happen when the scriptcase try to send the email, the variable "sc_mail_ok" will receive "false" and the error message will be stored on the variable "sc_mail_erro".
Ex.4 : sc_mail_send([glo_smtp], '', '', 'from@netmake.com.br', {to}, {subject}, {message}, 'H');
if ({sc_mail_ok}) { echo "sent {sc_mail_count} e-mail(s) with success!!"; } else { sc_error_message({sc_mail_erro}); }
|