sc_mail_send(SMTP, Usr, Pw, From, To, Subject, Message, Mens_Type, Copies, Copies_Type, Port, Connection_Type, Attachment, SSL)

This macro its 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 recieve the message, it could be a string or variable that cointains 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 recieve the message, it could be a string or variable that cointains one or more emails separated by ";" or one variable that contains one array of emails.
Copies_Type Type copies: BCC (Hiden 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';

Note: To use safe connection its required to have the PHP "php_openssl" extension enable.

Ex. 1:
sc_mail_send('smtp.meuserver.com.br', 'usr', 'pw', 'from@netmake.com.br'
, 'to@netmake.com.br', 'Test Email Subject', 'Message', 'H', 'abc@cop.com.br;zxy@cop.com.br', 'H', '', '', 'c:/test/arq.txt');


Ex. 2: Usising 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}, {sunject}, {message}, 'H', '', '', '', '', [glo_att]);

The amount of emails sent will be stored at the special variable "sc_mail_count".

If any error happend when the scriptcase try to send the email, the variable "sc_mail_ok" will recieve "false" and the error message will be stored on the variavle "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 sucess!!";
}
else
{
sc_error_message({sc_mail_erro});
}