Hi Monks,

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.