[oclug]perl mailing question
gabriel
the.angel.gabriel at rogers.com
Wed Nov 13 06:39:59 EST 2002
you need to escape the @ (\@) in the $recipient variable. also, i'd suggest
using " instead of ' to define variables.
On November 13, 2002 04:14 pm, Ian Wormsbecker wrote:
> I am trying to get perl to send me an email. I have no control over the
> machine this is running on so I am not sure how to get more information
> than I have at the moment.
>
> I am expecting that running this script should result in an email sent to
> myself, as well as 'Sent' being printed to my screen. Instead I get an
> internal server error. The permissions on the file are 'rwxr-xr-x'. I can
> run other perl scripts that don't send mail. AND, the kicker is I have a
> more complex script that mails me just fine. So, in order to debug I made
> this simple one to hopefully figure this out.
>
> I assume I have just made a simple mistake so...
> Any help is greatly appreciated.
>
> Ian
>
> Here is the test script I have:
>
> #!/usr/bin/perl
>
> $mailprog = '/usr/sbin/sendmail';
> $recipient = 'i.wormsbecker at uleth.ca';
>
> open (MAIL, "|/usr/sbin/sendmail -t -i") | dienice("Can't access
> $mailprog\n");
>
> print MAIL "To: $recipient\n";
> print MAIL "Subject: testing\n\n";
> print MAIL "Test email\n";
> close MAIL;
>
> print "Content-Type: text/html; charset=ISO-8859-1\n\n" ;
> print "Sent\n";
>
> sub dienice {
> my($errmsg) = @_;
> print "<h2>Error</h2>\n";
> print "$errmsg<p>\n";
> print "</body></html>\n";
> exit;
> }
>
> _______________________________________________
> oclug mailing list
> oclug at lists.oclug.on.ca
> http://www.oclug.on.ca/mailman/listinfo/oclug
More information about the OCLUG
mailing list