I have a server which is local (192.168.0.10) and I know mailx works correctly, because I can send an email directly from the terminal, even if I am local. This is the beauty of SimpleSMTP.
I have a program that sends an email with ssmtp (SimpleSMTP) via mailx. If the email is sent and there is no error, the user gets the sms and the web user gets back to the main menu page. If there is an error (Telus blocks me after a few tries), I tried to catch it with the END statement to send it back to the main menu, but it doesn't work.
Here is the code, with dummy email and domain: It's part of a sub:
In the web site logs, I get "mailx: ... message not sent:".
Thanks in advance.
$courrielclient="5555555555\msg.telus.com"; $textecourriel = "Ceci est un test de message texte (SMS)"; $sujet = "Test de rappel de rendez-vous $nomfournisseurcellulaire"; $from = "nepasrepondre\@testsms.ca"; open( my $mail, "| mailx -r $from -s $sujet $courrielclient"); say ("$mail $textecourriel"); close $mail; END { my $redirect = "/cgi-bin/chiro/menuprincipal.pl"; print "Location:$redirect\n\n"; }
In reply to catch die from say by PierreForget
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |