Jump to content

Add from field in PHP Email


Kval

Recommended Posts

Hello...

 

I have a site that sends an email using the following code:

 

mail($email,"Welcome to ohio-dui-laws.com","Hello ".$fname.",\n\nYour account on Ohio Dui Laws has been created.\nPlease login and fill out your profile details in order to have access to all the member content. \n\n\tUsername : ".$email." \n\tPassword : ".$_POST["password"]."\n\nThanks for joining http://Ohio-dui-laws.com");

 

Currently, when the recipient receives the email the From is defaulting to the server and looks like this:  ohiodui@209747.axxs.overnighthosting.com

 

What I would like is for the From in the email header to show noreply@ohio-dui-laws.com.

 

Would you be so kind and add whatever I need to the above code so that it displays noreply@ohio-dui-laws.com?

 

Thank you so much.

 

 

 

Link to comment
Share on other sites

you'll want to add a headers parameter

$headers = 'From: Birthday Reminder <birthday@example.com>' . "\r\n"

just insert whatever email you want...so your mail() function will look like this now

mail($email,"Welcome to ohio-dui-laws.com","Hello ".$fname.",\n\nYour account on Ohio Dui Laws has been created.\nPlease login and fill out your profile details in order to have access to all the member content. \n\n\tUsername : ".$email." \n\tPassword : ".$_POST["password"]."\n\nThanks for joining http://Ohio-dui-laws.com", '$headers');

Link to comment
Share on other sites

you'll want to add a headers parameter

$headers = 'From: Birthday Reminder <birthday@example.com>' . "\r\n"

just insert whatever email you want...so your mail() function will look like this now

mail($email,"Welcome to ohio-dui-laws.com","Hello ".$fname.",\n\nYour account on Ohio Dui Laws has been created.\nPlease login and fill out your profile details in order to have access to all the member content. \n\n\tUsername : ".$email." \n\tPassword : ".$_POST["password"]."\n\nThanks for joining http://Ohio-dui-laws.com", '$headers');

 

Thank you my friend.  Okay...$headers was displaying as full text in the body of the email.  I change to double quotes:

 

mail($email,"Welcome to ohio-dui-laws.com","Hello ".$fname.",\n\nYour account on Ohio Dui Laws has been created.\nPlease login and fill out your profile details in order to have access to all the member content. \n\n\tUsername : ".$email." \n\tPassword : ".$_POST["password"]."\n\nThanks for joining http://Ohio-dui-laws.com", "$headers");

 

Plus, sadly it still is not working.  The header says: ohiodui@209747.axxs.overnighthosting.com.  I did copy and past the <head> info:

$headers = 'From: Ohio-DUI-LAWS/DUI Self Help Website <noreply@ohio-dui-laws.com>' . "\r\n"

 

Any thoughts?

 

Thank you again,

 

Kevin

Link to comment
Share on other sites

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.