Results 1 to 4 of 4

Thread: Problems with sending an e mail with php

Hybrid View

  1. #1
    Join Date
    Mar 2012

    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

    //setting ini
    ini_set("SMTP", "mail.7ansafer.com");

    // generate new password to be sent to the user

    //getting ready to send e mail
    $subject="Your new password ";
    $body ="
    Dear $dbuser \n
    the message sent to the user telling him that he requested a new password and so on
    \n \n
    The new password ---> $generatepass";

    //mail function
    mail($to, $subject, $body, $headers);

    End of the code

    i,m waiting for your messages about this

  2. #2
    Join Date
    Sep 2008

    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.

  3. #3
    Join Date
    Mar 2012
    i tried to connect ( smtp.gmail.com ) but i still have the same message

  4. #4
    Join Date
    Sep 2008
    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?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center