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
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 = me@example.com

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
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 = me@example.com

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

Link to comment
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.