Jump to content

Sending an Email


Trium918

Recommended Posts

Is it possible to send an email from localhost using the

script below?

 

function notify_password($username, $password)
// notify the user that their password has been changed
{
    if (!($conn = db_connect()))
      return false;
    $result = mysql_query("select email from user
                            where username='$username'");
    if (!$result)
      return false;  // not changed
    else if (mysql_num_rows($result)==0)
      return false; // username not in db
    else
    {
      $email = mysql_result($result, 0, "email");
      $from = "From: support@phpbookmark \r\n";
      $mesg = "Your PHPBookmark password has been changed to $password \r\n"
              ."Please change it next time you log in. \r\n";
      if (mail($email, "PHPBookmark login information", $mesg, $from))
        return true;      
      else
        return false;     
    }
} 

Link to comment
https://forums.phpfreaks.com/topic/46468-sending-an-email/
Share on other sites

No result. I am getting  echo"Your password could not

be mailed to you. Try pressing refresh." from

 

Not sure if this is correct!!

sendmail_from = [email protected]

changed to

sendmail_from = localhost

 

 

 

<?
require_once("bookmark_fns.php");
do_html_header("Resetting password");

if ($password=reset_password($username))
{ 
    if (notify_password($username, $password))
      echo "Your new password has been sent to your email address.";
    else
      echo "Your password could not be mailed to you."
           ." Try pressing refresh.";
}
else
   echo "Your password could not be reset - please try again later.";

  do_html_url("login.php", "Login");

do_html_footer();
?>

Link to comment
https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226078
Share on other sites

Does anyone know how to send an email

from localhost?

 

This the code inside of php.ini

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

; For Win32 only.
;sendmail_from = [email protected]

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

Link to comment
https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226150
Share on other sites

Not that I know of. I think you either have to find freeware or download it. I know linux comes bundled with sendmail, but not windows.

 

Remember windows was built for "dumb" users to just click. Why would they want to educate and make life easier for their users =)

Link to comment
https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226190
Share on other sites

Not that I know of. I think you either have to find freeware or download it. I know linux comes bundled with sendmail, but not windows.

 

Remember windows was built for "dumb" users to just click. Why would they want to educate and make life easier for their users =)

 

Im trying it your way right quick.

Be right back

Link to comment
https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226191
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.