Page 1 of 1

new server - mail() not working

Posted: Wed Mar 02, 2005 9:49 am
by Swede78
Hi,

I've setup our websites on a new Windows 2003 server. We use a program called SmarterMail to handle the email. I have tried everything I could with php.ini, setting the SMTP line with every possible combination I can think of and rebooting, but it keeps giving me an error that it cannot connect with the SMTP server.


[mail function]
; For Win32 only.
SMTP = *

* I've tried every mail.domain.com that we have, I've tried localhost, the IP of the localhost, the IP of the smartermail server. Everything, but it just doesn't connect. And I reboot after each try, so I'm just stumped. Any suggestions?

Posted: Wed Mar 02, 2005 10:03 am
by feyd
does your smtp server require authentication?

you may want to look into phpmailer: http://phpmailer.sf.net

Posted: Wed Mar 02, 2005 10:37 am
by Swede78
No, I have it set to not require it.

Posted: Wed Mar 02, 2005 11:40 am
by Swede78
I've been able to get SMTP to connect. My Smartmail program was setup to go to the actual website's IP, when it was supposed to be going to the mail server's IP.

So, it now connects. But, now I'm getting another error. Using this simple test for mail():

Code: Select all

// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('email@domain.com', 'My Subject', $message);
I am getting this error message:
PHP Warning: mail(): SMTP server response: 550 <email@domain.com> No such user here in C:\Inetpub\---\sendemail.php on line XX
Obviously, I am substituting "email@domain.com" with a real working email address.

Any ideas?

Posted: Wed Mar 02, 2005 4:02 pm
by heiatufte
If the email adress you're using really IS working then it's most likely a problem with the email server. You can f.ex. create a hotmail account and test with that if you want to check if sending works. Try another email server (free trial versions are everywhere), check your spelling, check all the settings in SmarterMail, check the settings for the account you're using etc. etc. You probably already knew all that but.. well if you didn't, you do now. :)

Posted: Thu Mar 03, 2005 9:17 am
by Swede78
Thanks heiatufte, I finally got it working. I tried your suggestion. The reason my original test email address wasn't working was very strange. I have 2 websites. 1 is still located on another server. So, I was trying to send a test email to an account on that other server. But, in Smarter Mail, I had already setup the account information for that other website that would eventually be moved over. Apparently, SmarterMail was trying to send the email to the pre-made account on the same server it is on, rather than the real account on the other server.

I hope you can follow. I would have never thought of that, seeing as the test email I was using was a working email address on different server.

So, my lesson learned, SmarterMail (possibly other email software) will try to send email to a non-working dummy account set-up on its server, even if there is a real working email account with the same name on another server.