Simple mail() question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
enchance
Forum Commoner
Posts: 34
Joined: Sat Sep 15, 2007 12:10 pm

Simple mail() question

Post by enchance »

How do you change the name from the "From" field when mail is received when using mail()? I already checked out the mail() function but I probably just missed it so I thought maybe you would know.
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: Simple mail() question

Post by Syntac »

Set the "From" header.
enchance
Forum Commoner
Posts: 34
Joined: Sat Sep 15, 2007 12:10 pm

Re: Simple mail() question

Post by enchance »

Syntac wrote:Set the "From" header.
I already have this as my headers

Code: Select all

 
$headers = "Reply-To: site@domain.com\r\n";
$headers .= "From: site@domain.com\r\n";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
What should I add?
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: Simple mail() question

Post by Syntac »

So is it working?
enchance
Forum Commoner
Posts: 34
Joined: Sat Sep 15, 2007 12:10 pm

Re: Simple mail() question

Post by enchance »

Syntac wrote:So is it working?
In the From header, I swapped site@domain.com with a name and I also tried it with name<site@domain.com> but still nothing. What else should I try?
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: Simple mail() question

Post by Syntac »

Try changing the "Reply-To" header as well. Some clients ignore the "From" header.
enchance
Forum Commoner
Posts: 34
Joined: Sat Sep 15, 2007 12:10 pm

Re: Simple mail() question

Post by enchance »

Syntac wrote:Try changing the "Reply-To" header as well. Some clients ignore the "From" header.
Nope, still nothing. I'm not getting the text I typed in the "From" and "Reply-To" header. Any guesses?
User avatar
Syntac
Forum Contributor
Posts: 327
Joined: Sun Sep 14, 2008 7:59 pm

Re: Simple mail() question

Post by Syntac »

It works for me... Sorry, I don't know.
enchance
Forum Commoner
Posts: 34
Joined: Sat Sep 15, 2007 12:10 pm

Re: Simple mail() question

Post by enchance »

Syntac wrote:It works for me... Sorry, I don't know.
I guess it must be a server thing. Thanks anyway for trying to help me out.
Post Reply