Rianna Posted May 25, 2006 Share Posted May 25, 2006 Hi, does anyone know how to make the form message that comes to my email address contain a different From: address?The area in our emails where it says Subject: Date: From: To:I would like the from area to say my own email address, not the long sever address they give me.Thanks a lot, Jen Quote Link to comment https://forums.phpfreaks.com/topic/10419-examplelinhost122prodmalibusecureservernet/ Share on other sites More sharing options...
wisewood Posted May 25, 2006 Share Posted May 25, 2006 $to = "recipient@email.com";$from_address = "sender@email.com";$from_name = "Your Name";$subject = "This is the subject";$message = "your message here";$headers .= "From: \"".$from_name."\" <".$from_address.">\n";mail($to, $subject, $message, $headers); Quote Link to comment https://forums.phpfreaks.com/topic/10419-examplelinhost122prodmalibusecureservernet/#findComment-38835 Share on other sites More sharing options...
Rianna Posted May 25, 2006 Author Share Posted May 25, 2006 OK Thanks a lot. I added this per your instructions.$headers .= "From: \" <".$from_address.">\n";mail($message, $headers);$from_address = "myemailaddress@myemailaddress";$message = $_REQUEST['message'];mail("myemailaddressagain", "Sent From Form", $headers,""$message,"" );This is the only thing I changed in my php code. But now it doesn't work at all. So the error is just in the above part.Can you see anything wrong with it? Jen[!--quoteo(post=376945:date=May 25 2006, 04:45 AM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ May 25 2006, 04:45 AM) [snapback]376945[/snapback][/div][div class=\'quotemain\'][!--quotec--]$to = "recipient@email.com";$from_address = "sender@email.com";$from_name = "Your Name";$subject = "This is the subject";$message = "your message here";$headers .= "From: \"".$from_name."\" <".$from_address.">\n";mail($to, $subject, $message, $headers);[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/10419-examplelinhost122prodmalibusecureservernet/#findComment-38861 Share on other sites More sharing options...
Crimpage Posted May 25, 2006 Share Posted May 25, 2006 How about showing us the code that you are currently using, so we can tell you how to change it. Quote Link to comment https://forums.phpfreaks.com/topic/10419-examplelinhost122prodmalibusecureservernet/#findComment-38865 Share on other sites More sharing options...
Rianna Posted May 25, 2006 Author Share Posted May 25, 2006 OK sure, not much more to it. Jen<?php$headers .= "From: \" <".$from_address.">\n";mail($message, $headers);$from_address = "myemailaddress@myemailaddress";$message = $_REQUEST['message'];mail("myemailaddressagain", "Sent From Form", $headers,""$message,"" );header( "Location: [a href=\"http://mywebaddress/thankyou.html");\" target=\"_blank\"]http://mywebaddress/thankyou.html");[/a]?> Quote Link to comment https://forums.phpfreaks.com/topic/10419-examplelinhost122prodmalibusecureservernet/#findComment-38869 Share on other sites More sharing options...
wisewood Posted May 25, 2006 Share Posted May 25, 2006 you're declaring the message and from_address after the point where you've used them.This has been tested and works.<?php$to = "recipient_email_address";$from_address = "senders_email_address";$from_name = "senders_name";$subject = "subject_of_the_email";$message = "Message_body_goes_here";$headers .= "From: \"".$from_name."\" <".$from_address.">\n";mail($to, $subject, $message, $headers);header( "Location: [a href=\"http://mywebaddress/thankyou.html");\" target=\"_blank\"]http://mywebaddress/thankyou.html");[/a]?> Quote Link to comment https://forums.phpfreaks.com/topic/10419-examplelinhost122prodmalibusecureservernet/#findComment-38881 Share on other sites More sharing options...
Rianna Posted May 25, 2006 Author Share Posted May 25, 2006 Got it! Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/10419-examplelinhost122prodmalibusecureservernet/#findComment-39054 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.