mail sending failed
I am getting the following error while sending the mail.
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in mysitepath\test\mail.php on line 12
Please guide me.
does exactly whats saying on the tin. Are you running this on your web server, or a local server?
Basically if you hadn't guessed its saying that your php is setup to send emails via your localhost. But it seems your localhost does not have an SMTP server running.
Not too sure if this is right but I'll give it a go...
If you are running your file from a localserver then you need to access your php.ini file. Within the file you will find:
You need to correct it so your SMTP = mail.yourISP.com.
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = email@example.com
(yourISP is the name of your Internet Service Provider eg. mail.optusnet.com.au)
Otherwise, if you are running from a host, then they will be the ones who have access to the php.ini file and it should be configured for you.
Hope this helps...(I could be wrong so don't take it as gospel)
I use ini_set() function to set SMTP in my mail.php.
But now I am getting another error
Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for firstname.lastname@example.org in mysitepath\test\mail.php on line 14
please help me.
Thanks a lot,
But before following the steps I want to clease doubt.
I am using apache,so making changes ti IIS , does it affect anything.
I am not absolutely certain of the answer to that, however, if you are working on a local server, what's the harm in giving the tutorial a trial to see if works. If it doesn't just change the settings back to what they were.
It's all about the trial and error - that's the way to not only learn, but also to understand.
Best of luck though - please let us know of the outcome if you do try it.