Help !! I don't know why this error when I use mail function

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
jvizuete
Forum Newbie
Posts: 1
Joined: Thu Dec 01, 2005 10:21 am

Help !! I don't know why this error when I use mail function

Post by jvizuete »

Hi !! When I try send a mail using mail function, the next message appears:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing

And yes, I put From address, but ....

Please, can someone help me?
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Re: Help !! I don't know why this error when I use mail func

Post by foobar »

jvizuete wrote: Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing
Open up your php.ini and search for sendmail_from. Set it to something and try again.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Sometimes just setting the From field doesn't work, you need to set an additional -f flag:

Code: Select all

mail($to_address,$subject,$message,$from_address,"-fmyemailaddress@domain.ca");
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

pickle wrote:Sometimes just setting the From field doesn't work, you need to set an additional -f flag:

Code: Select all

mail($to_address,$subject,$message,$from_address,"-fmyemailaddress@domain.ca");
This happened to me while my DNS was propagating. After it resolved and it was a valid domain name and nameservers, my mail functions no longer need the -f thingermabob.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply