Forum Moderators: coopster

Message Too Old, No Replies

email problem

         

evolozik

5:50 pm on Jan 16, 2007 (gmt 0)

10+ Year Member



hi everyone,
my php.ini mail section is setup as follows:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

then in my php script:
<?php
mail("joecool@hotmail.com", "Testing", "Line 1\nLine 2\nLine 3", "From: tom@hotmail.com") or die("email error");
?>

i have also run mercury mail but i keep getting this error:
Warning: mail() [function.mail]: SMTP server response: 553 We do not relay non-local mail, sorry. in C:\Program Files\xampp\htdocs\test.php on line 2

on all tutorials that i went, the mail function is written this way
what is wrong?

mcavic

8:18 pm on Jan 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The PHP code is fine, the problem is that your mail server is refusing to relay messages.

Jaunty Edward

9:11 pm on Jan 16, 2007 (gmt 0)

10+ Year Member



HI,

please try to understand these settings:

SMTP = localhost
smtp_port = 25

it says that php will try to use Localhost(the computer on which the script is being run from) to send email using smtp port.

In your case your server is not configured as a SMTP server. You will either have to install a SMTP server, like how we install Apache,IIS and others as web servers.

Please note even IIS can act as a smtp server but tehre are many of them available for free.

Also SMTP server usally run on port 25.

If you do not have the SMTP server installed on your PC you will have to upload it on the production server, usally all hosting providers have SMTP. So if you will run the script on the server it will surely send the emails.

Hope this helps,
Thanks
bye