SOLVED: mail function, localhost, & email domain name

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
mondsteigen
Forum Newbie
Posts: 17
Joined: Sat Jan 14, 2012 9:59 pm

SOLVED: mail function, localhost, & email domain name

Post by mondsteigen »

I have a problem with using mail function to send email from localhost. It works only with @gmail.com address. I've tried with @yahoo.com and .me addresses; mails are sent to those addresses (I know this because I don't get the error message) but they don't arrive. How can I solve this problem?
Last edited by mondsteigen on Sun Feb 12, 2012 10:53 am, edited 1 time in total.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: mail function, localhost, & email domain name

Post by Celauran »

mondsteigen wrote:mails are sent to those addresses (I know this because I don't get the error message)
This is not necessarily true. The mail() function returning TRUE does not mean your MTA successfully delivered the mail. Check your mail server logs.
mondsteigen
Forum Newbie
Posts: 17
Joined: Sat Jan 14, 2012 9:59 pm

Re: mail function, localhost, & email domain name

Post by mondsteigen »

I checked the log. It says
to=<xxxxxxxx@ymail.com>, relay=mta1.am0.yahoodns.net[66.94.238.147]:25, delay=28684, delays=28690/0.01/0/0.05, dsn=5.0.0, status=bounced (host mta1.am0.yahoodns.net[66.94.238.147] said: 501 Syntax error in parameters or arguments (in reply to MAIL FROM command))
You were right, Celauran. How can I fix this?
Last edited by mondsteigen on Sun Jan 22, 2012 3:51 pm, edited 1 time in total.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: mail function, localhost, & email domain name

Post by Celauran »

The error suggests a malformed 'from' address. Are you adding From headers to the mail() call?
mondsteigen
Forum Newbie
Posts: 17
Joined: Sat Jan 14, 2012 9:59 pm

Re: mail function, localhost, & email domain name

Post by mondsteigen »

Yes. It reads:

Code: Select all

$headers = 'From: me <me@hushmail.me>';
This works when I send mails to gmail addresses. Do you think it's a problem with the receiving side? Do I need to config php.ini somehow?
mondsteigen
Forum Newbie
Posts: 17
Joined: Sat Jan 14, 2012 9:59 pm

Re: mail function, localhost, & email domain name

Post by mondsteigen »

This problem is now solved.
Post Reply