Azsen Posted August 16, 2010 Share Posted August 16, 2010 Hi, I want to create a forgotten password page, where the user enters in their email address, the script queries the database for that email address, creates a unique ID, stores that unique ID in the database, then emails the unique ID and the User ID off to the user in an HTML link e.g. http://somesite.com/reset-password.php?userId=2&uniqueId=132832189312978312. The reset page would then match the unique ID to the one in the database and let them enter in a new password into the form. Ok so I can do most of that so far except from the emailing to the user. I'm running an Ubuntu Server 10 at the moment as my test server which is on my local network. Do I need to set up a mail server on that for php mailing to work, or can I use some external SMTP for sending? I've had a play round with the PHP mail() function but it won't send anything at the moment. I'll also need some code for when the site is running in the hosted live environment as it will likely use their mail servers. What's the best way to go about doing this? Many thanks! Quote Link to comment https://forums.phpfreaks.com/topic/210835-resetting-user-password-by-sending-email/ Share on other sites More sharing options...
Azsen Posted August 16, 2010 Author Share Posted August 16, 2010 I've been playing with the PEAR mail sending functionality on this example: http://www.blog.highub.com/javascript/javascript-core/make-ubuntu-php-localhost-mail-function-work/comment-page-1/#comment-3059 It actually sends the email and I can get it in my gmail but I get about 50 lines of errors saying: Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/mimePart.php on line 307 Strict Standards: Non-static method Mail_mimePart::encodeHeader() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/mime.php on line 1316 Strict Standards: Non-static method Mail_mimePart::_explodeQuotedString() should not be called statically, assuming $this from incompatible context in /usr/share/php/Mail/mimePart.php on line 827 Strict Standards: Non-static method Mail::factory() should not be called statically in /opt/lampp/htdocs/sportsite/sendmail.php on line 28 What's up with that? Also do many web hosts have PEAR on them? I'm a bit dubious about relying on it if most web hosts don't actually run it. Quote Link to comment https://forums.phpfreaks.com/topic/210835-resetting-user-password-by-sending-email/#findComment-1099846 Share on other sites More sharing options...
Azsen Posted August 24, 2010 Author Share Posted August 24, 2010 Ended up using Zend for emailing in the end. Forget about using PEAR for email until they fix the strict error messages. Seems to be broken at the moment. You can always turn the error messages off with ini_set('display_errors', '0'); but that's probably not the best solution. The Zend mail functionality is very good and not too hard to figure out. http://zendframework.com/manual/en/zend.mail.html Quote Link to comment https://forums.phpfreaks.com/topic/210835-resetting-user-password-by-sending-email/#findComment-1103029 Share on other sites More sharing options...
AdRock Posted August 24, 2010 Share Posted August 24, 2010 Have a look here http://www.plus2net.com/php_tutorial/php_forgot_password.php Quote Link to comment https://forums.phpfreaks.com/topic/210835-resetting-user-password-by-sending-email/#findComment-1103036 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.