mail() error
Moderator: General Moderators
mail() error
I keep gettign this error when using the mail() function.
Warning: mail() [function.mail]: SMTP server response: 550 5.1.0 <<Firstname Lastname> email@gmail.com> missing or malformed local part in C:\Program Files\BitNami WAPPStack\apache2\htdocs\ascprojects\tracker\activity.php on line 114
I think the problem is that I am using gmail as my "send from" address, but I dont know what adress to use...Im hosting on my local machine, and i have my ISP set as the smtp adress in php.ini. What should I use as the "send from" adress?
Warning: mail() [function.mail]: SMTP server response: 550 5.1.0 <<Firstname Lastname> email@gmail.com> missing or malformed local part in C:\Program Files\BitNami WAPPStack\apache2\htdocs\ascprojects\tracker\activity.php on line 114
I think the problem is that I am using gmail as my "send from" address, but I dont know what adress to use...Im hosting on my local machine, and i have my ISP set as the smtp adress in php.ini. What should I use as the "send from" adress?
Last edited by swraman on Mon Feb 16, 2009 4:59 am, edited 2 times in total.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: mail() error
What's the code you're using?
Re: mail() error
Sorry for the confusion...I guess I have to rephrase my question.
What email adress can I use for my outgoing "sendmail_from" address? Gmail certainly doesnt work (and as Google tells me, nothing that requires authentication will work).
So what will work then?
What email adress can I use for my outgoing "sendmail_from" address? Gmail certainly doesnt work (and as Google tells me, nothing that requires authentication will work).
So what will work then?
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: mail() error
The reason I asked to see the code was because the error is telling you that there is a syntax error in the email address 
You can use any address in sendmail_from, though there may some constraints in place due to SPF records. Such constraints would not cause the error you're getting though... the mail() function is being used incorrectly or the php.ini setting has a syntax error in it
It's hard to be sure without your code though, so it would be useful if you could post it
EDIT | Actually, I guess the outermost < and > brackets in the above code are added by the mail server... I suspect you've got the angle brackets around the "Firstname Lastname" portion, instead of being around the email address where they should be.
You can use any address in sendmail_from, though there may some constraints in place due to SPF records. Such constraints would not cause the error you're getting though... the mail() function is being used incorrectly or the php.ini setting has a syntax error in it
Now I'm not 100%, but that looks almost like something along the lines of "<<Firstname Lastname> email@gmail.com>" is being set as the email address rather than "Firstname Lastname <email@gmail.com>".The key point in the error wrote:550 5.1.0 <<Firstname Lastname> email@gmail.com> missing or malformed local part
It's hard to be sure without your code though, so it would be useful if you could post it
EDIT | Actually, I guess the outermost < and > brackets in the above code are added by the mail server... I suspect you've got the angle brackets around the "Firstname Lastname" portion, instead of being around the email address where they should be.
Re: mail() error
I think all the brackets are added in by the error display or Gmail.
the line of code is:
And:
returns:
If I omit the $messageheaders var, I get an error telling me to specify an outgoing email address in php.ini. I feel like this is the problem, and I dont know what email address I can use as an outgoing address. But if I'm wrong please correct me. What email adresses can you use as the outgoing email address?
the line of code is:
Code: Select all
mail($email, $subject, $message, $messageHeaders);Code: Select all
echo(nl2br("$email \n $subject \n $message \n $messageHeaders \n"))Im pretty sure the error is with the From: Address. In the input vars ($email, $subject, $message, $messageHeaders), I never specify my name as the sender, just my email address. But in the error it has my name; my guess is that it is erroring b/c it is trying to use my gmail as the sending adress, but when it contacts Gmail's server and gets my name, it doesnt allow it to send under that address since the request is coming from a different domain.
If I omit the $messageheaders var, I get an error telling me to specify an outgoing email address in php.ini. I feel like this is the problem, and I dont know what email address I can use as an outgoing address. But if I'm wrong please correct me. What email adresses can you use as the outgoing email address?
Re: mail() error
There must be a way to do it wothout using an external script, otherwise what would the purpose be in having the function?
How do I use it without an external script? what are the requirements for the email adress so that it will work with the mail() function?
How do I use it without an external script? what are the requirements for the email adress so that it will work with the mail() function?
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: mail() error
What does this show?
Code: Select all
<?php
var_dump(ini_get('sendmail_from'));Re: mail() error
Well, I guess I dont need this anymore...on my local test server (local machine) the mail() function didnt work, but on my admin's test servers it apparently has a default email address that it sends from.
Thanks for the help though.
Thanks for the help though.