Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PERL Emailing problems! HELP!

Status
Not open for further replies.

ChillyBanana

Programmer
Sep 19, 2002
4
US
Hey guys,

I am trying to add an auto response email after when someone completes an inquiry form. The original script works fine which emails the inquiry to a specified email(s). I added the routine to send an email automatically to the email address provided by the user which works... but when I try to assign the "From:" field, it doesn't send the email! Any ideas why? Routine is listed below...

----------------
open (MAIL, "|/usr/lib/sendmail -oi -t");
print MAIL "To: talontire\@videotron.ca\n";
print MAIL "Bcc: webmaster\@talontire.com\n";
print MAIL "From: Ordering Information Page\n";
print MAIL "Subject: Ordering Information for $data{'your_name'}\n\n";
print MAIL "Make: $data{'make'}\n";
print MAIL "Model: $data{'model'}\n";
print MAIL "year: $data{'year'}\n";
print MAIL "Size: $data{'width'} $data{'ratio'} $data{'rim'}\n";
print MAIL "Name: $data{'your_name'}\n";
print MAIL "Order: $data{'order'}\n";
print MAIL "Status: $data{'status'}\n";
print MAIL "Ship Address: $data{'ship_address'}\n";
print MAIL "Ship City: $data{'ship_city'}\n";
print MAIL "Ship Province: $data{'ship_prov'}\n";
print MAIL "Ship Country: $data{'ship_country'}\n";
print MAIL "Ship Postal: $data{'ship_postal'}\n";
print MAIL "Home Address: $data{'home_address'}\n";
print MAIL "Home City: $data{'home_city'}\n";
print MAIL "Home Province: $data{'home_prov'}\n";
print MAIL "Home Country: $data{'home_country'}\n";
print MAIL "Home Postal: $data{'home_postal'}\n";
print MAIL "Day Phone: $data{'day_phone'}\n";
print MAIL "Evening Phone: $data{'evening_phone'}\n";
print MAIL "E-Mail: $data{'email'}\n";
print MAIL "Mailing List: $data{'list'}\n";
print MAIL "Comments: $data{'comments'}\n";
close (MAIL);
# Added routine below!
open (MAIL, "|/usr/lib/sendmail -oi -t");
print MAIL "To: $data{'email'}\n";
print MAIL "From: TalonTire.com\n"; # doesn't work!
print MAIL "Subject: Thank you $data{'your_name'} for you Inquiry/Order at TalonTire.com!\n\n";
print MAIL "Thank you for your recent inquiry to TalonTire.com. One of our tire techs will reply to you within 48 hours. (During peak periods -- April 1 to June 30 and Oct. 20 to Nov. 30 -- we suggest that you provide your phone number(s) in order to shorten the wait.)\n";
print MAIL "\n";
print MAIL "Sincerely,\n";
print MAIL "The TalonTire.com Staff\n";
close (MAIL);
-------------------------
Any help would be greatly appreciated!

Cheers,

Keith
 
I can't remember - is the From: field email address evaluated by sendmail?

Have you tried specifying what looks like a valid address there? Mike
________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
I don't know...

but when I send the first email, the 'From' field works with no problems. Sending the second email and assigning the 'From' field, doesn't send the confirmation email at all.

Keith
 
Does the From field only work when you fill it out with your email, or one based on your domain? If so, it's because your mail server is not an open relay (a good thing). It's the same problem I have - the From field only works for domains resident on my email server. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
When I send the first email, I hard-code the from field with 'Ordering Information' which works fine. Only when I try to hard-code the second email, it doesn't work and doesn't send. If I don't hard code the second email, it sends it but gives the server email address in the from field.

Thanks guys!
 
Try flushing the buffer between sends:

$| = 1; There's always a better way...
 
Thanks guys,

I tried both clearing the buffer and specifying a from address and both did not work properly.

Clearing the buffer, sent the email still but used the server email address.

Specifying the from address didn't send the secondary email out.

Any other ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top