jayzee Posted January 19, 2011 Share Posted January 19, 2011 When I get the form email from my website they come from "Nobody" Can I change that to "your website" or any other? i am using the following codes FOT HTML <form action="V019mail31.php"" method="post" id="contactform"> Full Name: <br /><input name="name" type="text" /><br /> Organization: <br /><input name="organization" type="text" /><br /> Designation: <br /><input name="designation" type="text" /><br /> Mailing Address:<br /> <textarea name="message" rows="3" cols="70"> </textarea><br /> Mobile: <br /><input name="mobile" type="text" /><br /> Telephone: <br /><input name="phone" type="text" /><br /> Fax: <br /><input name="fax" type="text" /><br /> Email: <br /><input name="email" type="text" /><br /> <input type="submit" /> </form> For PHP <? $name = $_REQUEST['name']; $organization = $_REQUEST['organization']; $designation = $_REQUEST['designation']; $message = $_REQUEST['message']; $phone = $_REQUEST['phone']; $mobile = $_REQUEST['mobile']; $fax = $_REQUEST['fax']; $email = $_REQUEST['email']; mail($email, "The Centre For Change - Thank you for your e-mail!", "Dear $name\n\n Thank You!\n\n We have received your request for registration.\n Please note that your confirmation is subject to receipt of payment.\n\nRegards\nThe Centre For Change"); mail( "[email protected]", "Online Registeration - $name ", "Online Registeration\n\nFull Name: $name,\nOrganization: $organization,\nDesignation: $designation,\nMailing Address: $message,\nMobile: $mobile,\nPhone: $phone,\nFax: $fax,\nEmail: $email,\nMailing Address: $message, " ); header( "Location: tu.html" ); ?> I have reviewed the old post but its still not solving my problem Need help You can vie the screenshot as well from here: On our recieving end: On Client End: (this is the auto-responder email sent to client as the form is submitted) Link to comment https://forums.phpfreaks.com/topic/224926-email-from-my-website-come-from-nobody/ Share on other sites More sharing options...
Coolkat Posted January 19, 2011 Share Posted January 19, 2011 The mail() function has an optional 4th (and 5th) parameter which can be used to set the From field. mail($to, $subject, $message, "From: [email protected]"); Check out the function options and examples here: http://us.php.net/manual/en/function.mail.php Link to comment https://forums.phpfreaks.com/topic/224926-email-from-my-website-come-from-nobody/#findComment-1161758 Share on other sites More sharing options...
DarkRanger Posted January 19, 2011 Share Posted January 19, 2011 The way you are doing this will confuse you if your mail scripts get complicated. Rather break it up into variables and mail from there. For your problem, add a headers variable and then add your From header in there. You can also specify a reply to address in the header variable if you want users to be able to reply to that email address and have it delivered elsewhere. $subject = "The Centre For Change - Thank you for your e-mail!"; $body = "Dear $name\n\n Thank You!\n\n We have received your request for registration.\n Please note that your confirmation is subject to receipt of payment.\n\nRegards\nThe Centre For Change"; $headers = "From: [email protected]"; mail($email, $subject, $body, $headers); $email = "[email protected]"; $subject = "Online Registeration - " . $name; $body = "Online Registeration\n\nFull Name: $name,\nOrganization: $organization,\nDesignation: $designation,\nMailing Address: $message,\nMobile: $mobile,\nPhone: $phone,\nFax: $fax,\nEmail: $email,\nMailing Address: $message, "; $headers = "From: [email protected]"; mail($email,$subject,$body,$headers); Link to comment https://forums.phpfreaks.com/topic/224926-email-from-my-website-come-from-nobody/#findComment-1161774 Share on other sites More sharing options...
jayzee Posted January 20, 2011 Author Share Posted January 20, 2011 Thanks a lot DarkRanger. finally its working perfectly now.. Thanks a really lot for your support. Link to comment https://forums.phpfreaks.com/topic/224926-email-from-my-website-come-from-nobody/#findComment-1162352 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.