does anyone how to solve this?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jauson
Forum Contributor
Posts: 111
Joined: Wed Oct 05, 2011 12:59 am

does anyone how to solve this?

Post by jauson »

Hi, does anyone how to solve this? I have a contact form but when I try it form doesnt work. Please give me suggestion. thanks.

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 C:\xampp\htdocs\test_run\hrportal\LeaveApplication.php on line 58
Please Try Again Later. Thank You.

this is my php.ini mail setup.


[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = jayson.lacson@da5.com.ph
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: does anyone how to solve this?

Post by Celauran »

Do you have a mail server installed? Is it running? Does it accept connections other than from PHP?
jauson
Forum Contributor
Posts: 111
Joined: Wed Oct 05, 2011 12:59 am

Re: does anyone how to solve this?

Post by jauson »

what mail server? I didnt have an idea for that.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: does anyone how to solve this?

Post by Celauran »

You can't send mail without a mail server. The error message says it can't connect to the mail server. Google
jauson
Forum Contributor
Posts: 111
Joined: Wed Oct 05, 2011 12:59 am

Re: does anyone how to solve this?

Post by jauson »

yes I saw a thread for mail server. hm. thank you so much :D
uday8486
Forum Newbie
Posts: 22
Joined: Fri Oct 28, 2011 11:42 pm
Location: Pune, India

Re: does anyone how to solve this?

Post by uday8486 »

This is due to your using a localhost. You need to put this code on a server which has a mail server.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: does anyone how to solve this?

Post by Celauran »

uday8486 wrote:This is due to your using a localhost.
No, it's not. You can run a mail server locally.
dsnraju
Forum Newbie
Posts: 10
Joined: Sun Oct 30, 2011 3:39 am

Re: does anyone how to solve this?

Post by dsnraju »

mail() function in php used to send emails.

The error displaying in your computer because you are using the code in localhost. put this code on a server which has a mail server
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: does anyone how to solve this?

Post by Celauran »

dsnraju wrote:The error displaying in your computer because you are using the code in localhost.
Again, no. This is simply not true.
Post Reply