drivenbytheson Posted August 14, 2009 Share Posted August 14, 2009 Hey guys, I have the following which works: // Send Info to Agent $myname = $_POST['name']; $from_name="My Website"; $from_address= "[email protected]"; $reply_name=$from_name; $reply_address=$from_address; $reply_address=$from_address; $error_delivery_name=$from_name; $error_delivery_address=$from_address; $to_name="Me"; $to_address="[email protected]"; $subject="Booking Information"; $message="Booking Requestion Information\n\nName: " . $_POST['name'] . "\n" . "Organization: " . $_POST['org'] . "\n" . "Event Description: " . $_POST['desc'] . "\n" . "Date(s): " . $_POST['dates'] . "\n" . "Budget: " . $_POST['budget'] . "\n" . "Location: " . $_POST['location'] . "\n" . "Zip: " . $_POST['zip'] . "\n" . "Contact Person: " . $_POST['conperson'] . "\n" . "Phone: " . $_POST['phone'] . "\n" . "Email: " . $_POST['email'] . "\r\n" . "Comments: " . $_POST['comments'] . "\n" . I'm trying to set $from_address= "[email protected]"; to $from_address= $_POST['email']; but I keep receiving "553 sorry, your mail was administratively denied." The reason being I want to add an auto responder for all email sent to "[email protected]". So $from_address needs to reflect the email address that the user inputs. Any help or can this not be done this way? Thanks! Link to comment https://forums.phpfreaks.com/topic/170296-contact-form-from-users-address/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 14, 2009 Share Posted August 14, 2009 The From: address in the email needs to be a valid email address hosted at the sending mail server or you need an SPF record at the domain in the From: address that says that your mail server is authorized to send email for that domain. Set the Reply-to: address to $_POST['email'] (after you validate it to prevent mail header injection.) Link to comment https://forums.phpfreaks.com/topic/170296-contact-form-from-users-address/#findComment-898324 Share on other sites More sharing options...
drivenbytheson Posted August 14, 2009 Author Share Posted August 14, 2009 Thanks for the help PFM Think I'm closer... // Send Info to Agent $myname = $_POST['name']; $from_name="Me"; $from_address= "[email protected]"; $reply_name=$_POST['name']; $reply_address=$_POST['email']; $error_delivery_name=$from_name; $error_delivery_address=$from_address; $to_name="Me"; $to_address="[email protected]"; $subject="Request Booking"; $message="Booking Request Information\n\nName: " . $_POST['name'] . "\n" . "Organization: " . $_POST['org'] . "\n" . "Event Description: " . $_POST['desc'] . "\n" . "Date(s): " . $_POST['dates'] . "\n" . "Budget: " . $_POST['budget'] . "\n" . "Location: " . $_POST['location'] . "\n" . "Zip: " . $_POST['zip'] . "\n" . "Contact Person: " . $_POST['conperson'] . "\n" . "Phone: " . $_POST['phone'] . "\n" . "Email: " . $_POST['email'] . "\r\n" . "Comments: " . $_POST['comments'] . "\n" . $email_message=new email_message_class; $email_message->SetEncodedEmailHeader("To",$to_address,$to_name); $email_message->SetEncodedEmailHeader("From",$from_address,$from_name); $email_message->SetEncodedEmailHeader("Reply-To",$reply_address,$reply_name); The email comes through ok but I don't get the auto reply that is setup on the email address [email protected]. Is it sending the auto reply to [email protected]? If there's a way to get this working can you dumb down the explanation a little bit. thanks for any help. Link to comment https://forums.phpfreaks.com/topic/170296-contact-form-from-users-address/#findComment-898351 Share on other sites More sharing options...
drivenbytheson Posted August 14, 2009 Author Share Posted August 14, 2009 anyone know if this its possible to do it this way or how i can easily add an auto reply to the above code? Link to comment https://forums.phpfreaks.com/topic/170296-contact-form-from-users-address/#findComment-898473 Share on other sites More sharing options...
PFMaBiSmAd Posted August 15, 2009 Share Posted August 15, 2009 The only code you have posted are the lines that are setting up the primary email that is sent using a To: address of - $to_address="[email protected]"; If the auto reply is supposed to be sent to the email address that was entered in the form, it would take seeing the code responsible for setting up that email. Unless you have an email verified member/sign up system, so that only logged in members with an email address on record (and the address on record is what is used in the auto reply, not an address entered in the form) can fill out your form and make form submissions (I don't see any member verification code in your form processing code), an auto replay email in response to any arbitrary email address that gets enters in a contact form is a bad idea as that will get your email server banned by the major ISP's when bot scripts find your form and start making submissions. The only reply email sent to an arbitrary email address that was entered in the form should be the actual manually generated reply in response to the form submission. Link to comment https://forums.phpfreaks.com/topic/170296-contact-form-from-users-address/#findComment-898815 Share on other sites More sharing options...
drivenbytheson Posted August 15, 2009 Author Share Posted August 15, 2009 Thanks for the explanation. I took your advice and changed the way I was trying to accomplish the auto reply and managed to get a php auto responder working: /* auto reply */ $autoTo =$_POST['email']; $autoreply = "Thanks for you submission!"; mail($autoTo, "Auto Reply Subject", $autoreply, 'From: [email protected]'); Is it possible to include a pdf file attachment to the auto response message? If so how would that look? Link to comment https://forums.phpfreaks.com/topic/170296-contact-form-from-users-address/#findComment-899022 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.