Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forgotten Password - Mail details

Status
Not open for further replies.

sipps

Technical User
Feb 9, 2003
133
GB
Hi all,

I have been looking for FAQ's or scripts in how to generate emails to send customers their details if they forget their password. Is there a good place that I can get this information that anyone knows of?

I just want them to be able to click on a link which takes the email address they entered in a form box and get the details applying to that email and send it to the customer.

Any help very much appreciated!
 
it would be far quicker to find the answer to your question if you break it into the steps you need to perform the task in a whole. There should be two main processes to it on the server level

-first is the comparison to the email address in a database
(sql where clasue execution etc..)

-second is the mailer script hat needs to be written for the task.
(mail components first you should use to match what is available and then syntax structures)

try searching for those topics and I'm sure you have the solution by night fall [wink] _________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
That isn't a big deal, but there are a handful of security issues (or potental security issues anyway) the first thing is that you'll need to make sure that 'every' email address a user signs up with is 'UNIQUE' meaning that no 2 users can have the same email address. This prevents "UserA" from getting "UserQ"'s password information.

from there all you need to do is have them submit the email address that should be associated w/ there account.

search your user database for the email address have it dump the login information, to the email address "providing it matches" using something like

<?
print &quot;<html><body>&quot;;
$recipient = &quot;$email&quot;;
$subject = &quot;Re: Your Login Information&quot;;
$message = &quot;$fname $lname,
Your Login Name is - $login
Your Password is - $password
$extra = &quot;From: What ever you want&quot;;
mail($recipient,$subject,$message,$extra);
echo &quot;Your Password will be emailed to you shortly!&quot;;
print &quot;</body></html>&quot;;
?>

If it doesn't match it should stop the process, tell them of the error, and have them retry.

Hope this helps..

KC
 
Thanks guys,

I had done the first part, typing in the email address searches through the db and brings back the details of that user ready to be mailed to them, but I completely see your point about two users using the same email address. I hadn't thought about that! Hopefully because this is a prototype system, it shouldn't matter, I know that the email could be made unique when users register on the system.
I just got to put the information that I have brought from the database and send it to the email address they entered.

Thank you both for your help.
 
Hi,

I have the script ready to mail the customer their details, using mail($recipient, $from, $message) and I try and call it when I press a submit button. It comes up with an error though, I think this is because it needs to use a mail server to send the message. Is there anyway that I can just test this function by using my own Outlook account to send these emails out?

Thanks
 
you can fill in your outlook SMPT / outgoing mail server adres (that you entered in the accounts tab) in the email part of php.ini

you will also hav to fill in an email here that is registered with the smpt server. (again whatever you entered in the accounts tab of outlook) I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
I filled in my SMTP server details, but I still get an error. The php.ini Mail section looks like this:

[mail function]
; For Win32 only.
SMTP = smtp.blueyonder.co.uk

; For Win32 only.
sendmail_from = sipps@talk21.com

I wanted to mail the user their forgotten password when they clicked a link, adn wrote the code like this:

<a href=&quot;<?php mail($to, $subject, $message, $from ) or print &quot;Could not send mail&quot;; ?>&quot;>mail me</a>

Is this ok to do?

The error message is:
<b>Warning</b>:Failed to Connect in <b>C:/Program Files/Apache Group/Apache2/htdocs/rentals/maildetails.php</b> on line <b>113</b><br>Could not send mail

I'm not sure whether this is a code problem from what I have written, or a problem with the php.ini file.

Any ideas?

Thanks
 
i dont know if that will work,
what u usually have is a form with name/mail/message fields, and when this gets submitted it gets sent with the mail sender... I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
sipps:

The line:

Code:
<a href=&quot;<?php mail($to, $subject, $message, $from ) or print &quot;Could not send mail&quot;; ?>&quot;>mail me</a>

will work, but probably not as you intend. The server will send the mail as it produces the output of the page, not when the user clicks on the link.

I can think of two ways for a user to click on a link and send an email:[ul][li]if you want to send the email from the client's machine, through his mail system, then use an <a>...</a> tag with the href attribute being a mailto URL:
Code:
<a href=&quot;mailto:joe@foo.com?subject=foo&quot;>click here</a>
[/li][li]Have the <a>...</a> tag point the browser to a script on your web server, and use GET-method input to send information to the script:
Code:
<a href=&quot;[URL unfurl="true"]http://yourserver.com/yourmailscript.php?to=joe@foo.com&subject=foo&message=test&quot;>click[/URL] here</a>
[/li][/ul] Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top