Jump to content

Recommended Posts

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
$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);
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]
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]
?>
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]
?>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.