Jump to content

About Masking PHP Mail "From" Address


phpQuestioner

Recommended Posts

My host requires me to list a email address from within my domain to send and receive php emails. So in my "From", I have to use [email protected]. Is there any way I can still keep my "From" address as a normal mailto email address (like: "[email protected]"), but display the name of my business in my clients email application?

 

 

 

 

 

 

 

Example

 

  Date      Subject                                                  From

 

03/27/07  John Doe's Roofing Has Receive Your Email    John Doe's Roofing Inc.

 

 

 

 

Is there any way I can do this?

Link to comment
https://forums.phpfreaks.com/topic/44451-about-masking-php-mail-from-address/
Share on other sites

not so much - if they see the email address that is fine; but I would just like them  to easily identify who the sender is. I think my customers would be more likely to realize who it is that is sending them an auto reply; if the business name was in the "From" section of their email client. I don't want them to just see an email address and not know who it is and just automatically think my auto replier is spam. You know what I mean? 

 

It may be filtered out as spam any way - automatically by their client; but I at least want to make an effort to establish auto reply.

In the mailing script, just change the from header to whatever you'd like.

 

$subject = "I Made Pizza";
$message = "=)";
$from = "That Wacky Pizza Dude";
$headers = "From: $from";
mail($email, $subject, $message, $headers);

echo "Ok, $username!<br />";
echo "Soon you should get an email!";

 

...or something like that.

<?php

@$Name = addslashes($_POST['Name']);
@$Email = addslashes($_POST['Email']);
@$Phone = addslashes($_POST['Phone']);
@$Comments = stripslashes($_POST['Comments']);

if () 
{
// For Validation Would Be Here
}

// The "From" cannot be changed to an address outside my domain - hosting rules

$header = "From: [email protected]\n"
  . "Reply-To: [email protected]\n";
$subject = "Order Confirmation";
$email = "$Email";
$message = "$Name We Have Successfully Received Your Email And Will Be Contacting You Soon.\n\n\nThank You For You Business\nJohn Doe's Roofing Inc.";
@mail($email, $subject ,$message ,$header ) ;

?>

So I tried this:

 

 

<?php

@$Name = addslashes($_POST['Name']);
@$Email = addslashes($_POST['Email']);
@$Phone = addslashes($_POST['Phone']);
@$Comments = stripslashes($_POST['Comments']);

if () 
{
// For Validation Would Be Here
}

// The "From" cannot be changed to an address outside my domain - hosting rules

$header = "From: John Doe's Roofing Inc. <[email protected]>\n"
  . "Reply-To: [email protected]\n";
$subject = "Order Confirmation";
$email = "$Email";
$message = "$Name We Have Successfully Received Your Email And Will Be Contacting You Soon.\n\n\nThank You For You Business\nJohn Doe's Roofing Inc.";
@mail($email, $subject ,$message ,$header ) ;

?>

 

 

but it still produced the same results. Actual email address is visible in the "From" section of email client.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.