Hi guys,
I happened to have experienced a problem related to my host’s smtp mail system… not SC6 this time
The error starts off with:
Fatal error: Uncaught exception ‘Swift_TransportException’ with message ‘Connection could not be established with host smtp.webfaction.com [php_network_getaddresses: getaddrinfo failed: Name or service not known #0]’ in
<I deleted the rest as it has path and stuff I would rather not expose>
But it did bring to life a problem - when this failure happened , it was at the last step of my user registration. That all actually worked well, except for the email not going out. PHP dumped a big dozen lines of errors on the smtp. What can I do to capture errors with the sc_mail_send command? If the email fails, I would rather just not have it sent, but take the user to a redirect page for greetings and info that way.
BTW - I read the help on that comand and have tried to use the code in the example - HOWEVER, this only seems to work on logical errors. By that I mean that if you get the type of fatal error I have experienced, it dies before the error code below can help you log anything. What should I do?
Example code:
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_erro_mensagem({sc_mail_erro});
}
Thanks,
Jamie