Problems with sending an e mail with php
i,m building ( forgotpassword.php) page in which i send the password to the email of the user who request it but i usually get this error message
Warning: mail() [function.mail]: Failed to connect to mailserver at "mail.7a*****er.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\tourism 1\forgotpassword.php on line 194
i tried many times but i failed
here is the code i,m using and i hope to know the reason of this message i get
// generate new password to be sent to the user
//getting ready to send e mail
$subject="Your new password ";
Dear $dbuser \n
the message sent to the user telling him that he requested a new password and so on
The new password ---> $generatepass";
mail($to, $subject, $body, $headers);
End of the code
i,m waiting for your messages about this
Have you confirmed your SMTP port number?
Also, have you tried connecting to a different server? For example, if you set up a Gmail account for testing, you could SMTP to it using one of the dozens of tutorials ( https://www.google.com/search?q=smtp...sm=93&ie=UTF-8 ) and confirm your script is working as expected. Then, when you have it working, try substituting the Gmail server with your own server credentials.
I hope that helps.
i tried to connect ( smtp.gmail.com ) but i still have the same message
Are you using a Windows server? I've read that setting up the internal mail function to use SMTP is only available on Windows.
We use sendmail() https://www.sendmail.com/sm/open_source/download/ to send mail via SMTP. Would that be an option?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)