Trium918 Posted April 10, 2007 Share Posted April 10, 2007 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 More sharing options...
gluck Posted April 10, 2007 Share Posted April 10, 2007 As long as your php.ini file has the servername and other config params set. you should try it and if it doesn't work paste the error. Link to comment https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226053 Share on other sites More sharing options...
Trium918 Posted April 10, 2007 Author Share Posted April 10, 2007 As long as your php.ini file has the servername and other config params set. you should try it and if it doesn't work paste the error. I think I find one but could someone give me the others to look for. sendmail_from = [email protected] Link to comment https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226060 Share on other sites More sharing options...
Trium918 Posted April 10, 2007 Author Share Posted April 10, 2007 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 More sharing options...
Trium918 Posted April 10, 2007 Author Share Posted April 10, 2007 Does anyone know how to send an email from localhost? Link to comment https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226106 Share on other sites More sharing options...
Trium918 Posted April 10, 2007 Author Share Posted April 10, 2007 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 More sharing options...
Trium918 Posted April 10, 2007 Author Share Posted April 10, 2007 Does anyone have an idea, Yes or No? Link to comment https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226172 Share on other sites More sharing options...
per1os Posted April 10, 2007 Share Posted April 10, 2007 You need a mail server. You also need your PORT 25 open, without that it probably won't work. google mail servers Link to comment https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226176 Share on other sites More sharing options...
Trium918 Posted April 10, 2007 Author Share Posted April 10, 2007 You need a mail server. You also need your PORT 25 open, without that it probably won't work. google mail servers I'm not sure frost110, but Window suppose to have one built into it right. Link to comment https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226187 Share on other sites More sharing options...
per1os Posted April 10, 2007 Share Posted April 10, 2007 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 More sharing options...
Trium918 Posted April 10, 2007 Author Share Posted April 10, 2007 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 More sharing options...
Trium918 Posted April 10, 2007 Author Share Posted April 10, 2007 You need a mail server. You also need your PORT 25 open, without that it probably won't work. google mail servers I couldn't get it working so I'll have to set it up on another server. Link to comment https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226252 Share on other sites More sharing options...
TEENFRONT Posted April 10, 2007 Share Posted April 10, 2007 Why do you need to send from localhost? Just send it from an email address on your server. [email protected]. Link to comment https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226256 Share on other sites More sharing options...
Trium918 Posted April 10, 2007 Author Share Posted April 10, 2007 Why do you need to send from localhost? Just send it from an email address on your server. [email protected]. Just practice to get a better understanding of it. My server is Apache on a Windows platform. Link to comment https://forums.phpfreaks.com/topic/46468-sending-an-email/#findComment-226304 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.