0

I am trying to send automated emails with a clean "From" address. When it sends the email its using the name I want with @my-website.com attached right after, how do I get rid of it?

Example

 $address = "[email protected]"; $subject = "Confirmation"; $msg = "Registered"; $headers = "From: MyWebsite \r\n"; mail($address, $subject, $msg, $headers); 

The result I get in my inbox when I test it is, [email protected] instead of just MyWebsite

5 Answers 5

1

I think

$headers = "From: MyWebsite <[email protected]> \r\n"; 

would do

If not, try reading http://www.sitepoint.com/advanced-email-php/

Sign up to request clarification or add additional context in comments.

Comments

0

It's working correctly. You need the complete domain with mail() it's required for the mail() function to parse and legally under the CAN-SPAM act.

Comments

0

Try this:

$headers = "From: MyWebsite <[email protected]> \r\n"; 

This will show the name "MyWebsite" in most email clients, and also includes your email address. (Valid email should have a real From: email address.)

Comments

0

Try setting the from address to the string (including the quotes):

"MyWebsite" <[email protected]> 

Comments

0

You can't specify MyWebsite as sender because it's not a valid email address. You could try the following code:

$headers = "From: MyWebsite <[email protected]> \r\n"; 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.