f



Mail::Sendmail

perl doesn't like my return address. Does anyone know why?

error message as follows--------------------
[rudi@tsuse rudi]$ perl mail_test.pl
[rudi@tsuse rudi]$ Bad or missing From address: ''

text of program follows----------------------
[rudi@tsuse rudi]$ vi mail_test.pl
      1 #!/usr/bin/perl;
      2 use Mail::Sendmail;
      3
      4 %mail = { To => "ccc31807\@yahoo.com",
      5     From => "cartercc\@gmail.com",
      6     Subject => 'Test of sendmail',
      7     Message => "This is a test of sendmail"};
      8
      9 $mailtest = sendmail (%mail) or die $Mail::Sendmail::error;
     10 print "mailtest is $mailtest\n\n";
     11 print "OK, Martha says:\t", $Mail::Sendmail::log;
     12
     13 exit();

Thanks in advance, CC

0
cartercc (463)
8/31/2005 7:33:35 PM
comp.lang.perl.misc 33233 articles. 2 followers. brian (1246) is leader. Post Follow

5 Replies
1147 Views

Similar Articles

[PageSpeed] 51

cartercc@gmail.com wrote:
> perl doesn't like my return address. Does anyone know why?
> 
> error message as follows--------------------
> [rudi@tsuse rudi]$ perl mail_test.pl
> [rudi@tsuse rudi]$ Bad or missing From address: ''
> 
> text of program follows----------------------
> [rudi@tsuse rudi]$ vi mail_test.pl
>       1 #!/usr/bin/perl;
>       2 use Mail::Sendmail;
>       3
>       4 %mail = { To => "ccc31807\@yahoo.com",
>       5     From => "cartercc\@gmail.com",
>       6     Subject => 'Test of sendmail',
>       7     Message => "This is a test of sendmail"};
>       8
>       9 $mailtest = sendmail (%mail) or die $Mail::Sendmail::error;
>      10 print "mailtest is $mailtest\n\n";
>      11 print "OK, Martha says:\t", $Mail::Sendmail::log;
>      12
>      13 exit();
> 
> Thanks in advance, CC
> 
You need

use strict;
use warnings;

This would have pointed out your error to you.

bob 502 $ perl -Mstrict -Mwarnings -le 'my %fg={a=>1}'
Reference found where even-sized list expected at -e line 1.
bob 503 $


Check out the posting guidelines.

Mark
0
Mark
8/31/2005 7:43:21 PM
cartercc@gmail.com wrote:
> perl doesn't like my return address. Does anyone know why?
> 
> error message as follows--------------------
> [rudi@tsuse rudi]$ perl mail_test.pl
> [rudi@tsuse rudi]$ Bad or missing From address: ''

What makes you believe it's _Perl_ that doesn't like your from address? 
Maybe it's the MTA.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
0
Gunnar
8/31/2005 7:49:28 PM
>  use warnings;
> This would have pointed out your error to you.

You are so right.

> Check out the posting guidelines.

Yeah.

My 55 yo eyes couldn't tell a parens from a curly brace, so I had at
least that excuse. However, I should have realized it when I was typing
it.

Thank you very, very much, and accept my apology for a little bit of
unnecessary trouble.

CC

0
cartercc
8/31/2005 8:34:31 PM
cartercc@gmail.com wrote:

> My 55 yo eyes couldn't tell a parens from a curly brace, so I had at
> least that excuse.

Not really:

use an editor with syntax highlighting, and one that lets you adjust the 
fontsize

use strict;
use warnings;

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        
0
John
8/31/2005 9:09:42 PM
cartercc@gmail.com wrote:
>> use warnings;
>>This would have pointed out your error to you.
> 
> 
> You are so right.
> 
> 
>>Check out the posting guidelines.
> 
> 
> Yeah.
> 
> My 55 yo eyes couldn't tell a parens from a curly brace, so I had at
> least that excuse. However, I should have realized it when I was typing
> it.

We've all done it. It's very easily done, as are a lot of other 
seemingly trivial typo errors caught by warnings and strict :)

Mark
0
Mark
9/1/2005 6:34:11 AM
Reply: