Robbie Staufer wrote:
> Hi,
>
> I have a perl script that takes in form data and generates and email
> with the data to be sent to me. I'm getting the error message
> Error:Bad or missing From address: '$from_address'. The webmaster says
> I'm using the correct from address, so, any ideas about this error message?
Hi Robbie.
You have a from address of literally '$from_address'. I think your webmaster
is wrong! See below.
> Here's what I have:
>
> ### send mail #####
>
> $from_address = "[EMAIL PROTECTED]";
> $to_address = "[EMAIL PROTECTED]";
> $subject = "ESMF Registration Form";
>
> %mail = (
> SMTP => 'finster.scd.ucar.edu',
> from => '$from_address',
> to => '$to_address',
> subject => '$subject',
> );
Using single quotes will prevent the scalar variables from being
expanded. These lines should be:
%mail = (
SMTP => 'finster.scd.ucar.edu',
from => "$from_address",
to => "$to_address",
subject => "$subject",
);
The name of the SMTP server will be OK with either single
or double quotes as there's nothing to expand in there.
> $mail{body} = <<END_OF_BODY;
>
> First Name: $fname
> Last Name: $lname
> Email: $email
> Organization: $org
> Scientific Interest: $sci_int
> Mailing List? $check
A 'here' document (which this is) works as if it is in double
quotes by default. You could change it to single-quote
working by putting the end tag in single quotes:
$mail{body} = <<'END_OF_BODY';
But don't, because that's not what yuo want!
> sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]