in reply to Re: catch die from say
in thread catch die from say

Sorry, I made a typo when copying the code. It should have read:
$courrielclient='5555555555\@msg.telus.com';
The original code was correct, but I didn't want the real phone number on the Internet.

Replies are listed 'Best First'.
Re^3: catch die from say
by PierreForget (Acolyte) on Apr 01, 2024 at 18:35 UTC
    Hi Monks and thank you for all the replies. Just to make sure, the following code is working perfectly and returns me to the menu page, until Telus blocks me after a certain number of tries per day. Then I get "Internal Server error" in the web page. I would like to catch the error (not FataltoBrowser, because I already have it in the logs) and make the Perl code continue and do the END part, so that I am redirected to the main menu page. Phone and domain are dummies for the example.
    #! /usr/bin/perl $email_message="test de Pierre"; $email_subject="test4"; $recipient="5555555555\@msg.telus.com"; $from = "nepasrepondre\@chirotest.ca"; open( my $mail, "| mailx -r $from -s $email_subject $recipient" ); say $mail $email_message; close $mail; END { my $redirect = "/cgi-bin/chiro/menuprincipal.pl"; print "Location:$redirect\n\n"; }
      Hi Monks, I changed the way of doing it and the following code seems to work perfectly, even in the case of an error generated by Telus. The culprit was the pipe "|" which sends to a bash script and do not return. Thanks for all the effort. And I removed the "\n", which got the variables unrecognized by mailx.
      #! /usr/bin/perl $email_message="test de Pierre"; $email_file ="/httpd/bureau.testchiro.ca/temp/sms"; $email_subject="test9"; $recipient="5555555555\@msg.telus.com"; $from = "nepasrepondre\@testchiro.ca"; system ("mailx -q $email_file -r $from -s $email_subject $recipient"); END { my $redirect = "http://192.168.0.10/index.html"; print "Location:$redirect\n\n"; }
      As soon as it's possible, may take a few days..., I will try the "q" option in mailx. Here is the code I will try:
      #! /usr/bin/perl $email_message="test de Pierre"; $email_subject="test4"; $recipient="5555555555\@msg.telus.com"; $from = "nepasrepondre\@chirotest.ca"; open( my $mail, "mailx -q /usr/pierre/bin/smstext.txt -r $from -s $ema +il_subject $recipient" ); say $mail $email_message; close $mail; END { my $redirect = "/cgi-bin/chiro/menuprincipal.pl"; print "Location:$redirect\n\n"; }