Help I am getting a "warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address" error when I try to submit a form from the feedback form. I am using the feedback module.
I have a valid email address in my default email.
I do not have "Validate Senders Email Address" checked.
I am running the website off of my own server. My other email functions work. Individuals who sign up are able to get their emails.

Any help would be greatly appreciated.



pobster’s picture

This could be a number of things... First off, why don't you post up your mail logs?

What I'm thinking is that you've no 'catch-all' email address for your domain. The feedback module sends YOU an email using apache@$myhostname or something like that anyway. It's likely that you've not got your mail server configured for this eventuality and your mail server thinks that someone is trying to use it as a relay. It's easily solved, but I'll need to know more about your system and what you're using as a mail server.

Of course... :o) It could be something completely different! ;o)

Pobster’s picture


I am running my server off of windows...I know I know...not the best decision. I am using apache.
Anyway, I checked the Event Finder and there are no mail logs in there.
FYI this is the entire error:
warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in C:\webserver\virtual_hosts\\modules\user.module on line 374.

Where will my mail logs most likely be?

Thanks for all your help


p.s. no making fun of the girly website...its a favor for my wife. ;-)

pobster’s picture

Are you *sure* your mail server is sending out emails? I've signed up for your VERY girly site ;o) And I've not received anything yet? I'm thinking that your problem is more than just for the feedback module...

Pobster’s picture

The emails do work on certain servers, but not all. I have tested it on hotmail, yahoo, and gmail and all of those work, yet I do not get the emails if I use my work email. Im sure there is a bigger problem with the email...but as long as people can register from the major free email accounts...I am fine with that.
Now, that being said, if you know how to fix it all together, I would love that.
Let me know if you can help.
Thanks again

Hot-screensaver’s picture

I came across this page while debugging the same error message... and I think I know what's the problem. On Windows server, the mail() function doesn't accept email address such as:

"name <>"

Change it to a simpler one like this will work:


Hope that helps.

snohio’s picture

I am running IIS 6.0 both for web services and SMTP mail.. (don't give me crap..)

Yes, this does appear to be the problem.. Through extensive logging with IIS when I send using this module the results look something like this:

2008-03-10 20:42:33 dc1 SMTPSVC1 DC1 0 RCPT - +TO: 250 0 28 25 0 SMTP - - - -
2008-03-10 20:42:33 dc1 SMTPSVC1 DC1 0 RCPT - +TO:> 501 0 27 37 0 SMTP - - - -

The 501 0 27 37 is the error.. It does not like how the name is formatted..

When I use the built-in contact form in the user section it is successful and the log files look like this:

2008-03-10 20:44:14 dc1 SMTPSVC1 DC1 0 MAIL - +FROM: 250 0 40 27 0 SMTP - - - -
2008-03-10 20:44:14 dc1 SMTPSVC1 DC1 0 RCPT - +TO: 250 0 30 27 0 SMTP - - - -

The message 250 0 30 27 0 is a successful code.. I would say it does not like the format this particual module is using for the TO: addresses.. Now to find the spot in the code to drop the name in that TO address..

Any help there would be greatly appreciated!

webtintin’s picture


I have a FORM with PHP with the same problem,
using the informations by Hot-screensaver I solved the problem.

We have to use a simple instruction, in my case like this :

infact I used : "name " and this gives error !!!!

Thanks a LOT,
Simone / Italy

colinm’s picture

i got this script from a web design company -- it doesn't work, and they are very difficult to work with. very.

it is supposed to get an email to send to and the person using the form's email, as well as email off a gif to the intended recipient. make sense?

here is what i get when using the form:

Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in E:\Websites\BMGSites\\mailForm.php on line 43
Could not send e-mail - Error A46GY7

the script:

//grab the server time
$current_time = strftime("Request was sent on %B %d, at %H:%M%p ");

//get company info
$companyName = "BS Industries";
$companyEmail = "";
//fetch user post vars
foreach( $_POST as $key => $val)
	$$key = $val;

//build mail
$to = $_POST['recipient'];
$subject = "You've Been Flagged!";
$msg =
"<html xmlns=''>
<body bgcolor='#FFD75B'><br /><br />
<table cellpadding='10' cellspacing='0' border='0' align='center' bgcolor='#ffffff'>
	<td align='center'><img src='' width='301' height='141' /></td>
	<td align='center' width='600'><h1>" . $FromEmail . " has sent you the BS Flag</h1>
	<h2>for the following reasons:</h2>
<blockquote>" . $Reason . "</blockquote>
<p><em>Learn more about the BS Flag at <a href=''></a>.</em></p></td>
<br /><br />

//send mail
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$companyName."\" <".$companyEmail.">\n";	

mail("$to", stripslashes($subject), stripslashes($msg), $headers) or die("Could not send e-mail - Error A46GY7");
//send the user to the response page
$redirect = "Location: " . $_POST['redirect'];

anyone, bueller, bueller . . .

martin e’s picture


I do use simplenews, mimemail on a windows server with IIS6.0 and I did face the same problem.
It seems that simplenews sends the wrong sender to mimemail. At least that is what I found.

On the newsletter/settings form I did use the email adress at the location of the From name.
Then everything working fine.

Is this the solution to you're problem. I don't know.
But it confirms the differences between apache and IIS and solves the problem for mimimail.


snohio’s picture

Well, instead of trying to debug this issue (you guys are welcome to do so), I found the following in the code and decided to give it a go:

// Check to see if the SMTP Authentication Support module (
// If it exists and is active, we have to do things differently with the recipient list.

I installed the SMTP module and configured it real quick - very simple module - and it fixed the issue. I would definitely recommend installing that module if you are running Microsoft IIS and SMTP service.

msimanga’s picture

I would like to confirm this was also the easiest fix for me.

Mpumelelo Msimanga

zvischutz’s picture

This was the only one that worked for me ! Thanks !

goose2000’s picture

On IIS 6 too, we are crazy rebels!

This little module work great for me. Does any one know if there is a fix for the IIS SMTP server so that it won't freak if you use the full name format that has really become the standard:

<John Doe> 

I'd still like it to work in a native way.

elninio’s picture

You won't have any trouble when the header's From is in this format -> $headers = 'From:';
But you get that warning when you insert a name (still in an RFC 2822 compliant format) such as -> $headers = 'From: Full Name <>';

Try setting the following before calling the mail function:

ini_set('sendmail_from', ';

Worked for me, hope it helps.

P.S: My PHP is on IIS 6 (I know... I know!)

chill8331’s picture

I did this in setting.php
ini_set('sendmail_from', '');

In php.ini
sendmail_from =

But it doesn't work for me. I'm trying to send out HTML newsletter from local. It's killing me!

Mine Mail


Send out text mail only.

[address] => Array
            [0] => "" <>

I print out something like this from mine mail when send. (Source code you can see. Can't see on screen!) I suppose this is some bug, no?

How does this come?

chill8331’s picture’s picture

I had this problem and it turned out to be caused by the fact that I had a period in my folder name (was working on a local dev machine running IIS).

Shyamji123456’s picture

When u turn your site on live and in smtp molule or phpmailer module should be disable and in case of smtp you have to remember to turn off first smtp services from admin/settings/smtp then should disable smtp module .

pobster’s picture

SMTP error does not relate to SMTP module...