• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Recipe 1. User Login > End User Recipe: Emailing Passwords

End User Recipe: Emailing Passwords

Forgotten passwords are a fact of life in the modern world, and unless handled dynamically, they’re an administrator’s nightmare. With the page we are about to build, users enter their mailing address and request their password. The application responds by looking up their mailing address, and if a match is found, the password is emailed to the user.

Setting Up for Server-Side Email

ASP, ColdFusion, and PHP all use different mechanisms to handle email. A separate email component is necessary for ASP, and numerous commercial ones are available. One of the most common is called Microsoft CDONTS (an abbreviation for Collaboration Data Objects for Windows NT Server). The CDONTS component is standard on all Windows servers since IIS 4.0 and up to Windows XP server, which uses a newer version called CDOSYS. Coding for CDOSYS is slightly different from that for CDONTS; examples for both are included in this recipe.

Although the component is included in most Windows servers, it might not be registered with the system. To register CDONTS, make sure cdonts.dll is included in the Windows directory that contains the other DLLs (on Windows 2000, [system drive letter]:\WINNT\system32). Then choose Start > Run and enter regsvr32 cdonts.dll in the Run dialog. The CDONTS component requires a valid SMTP server to successfully send the email.

ColdFusion, on the other hand, includes the email component right out of the box, and no additional component is required. You do, however, need to specify a valid SMTP server. In ColdFusion MX, this setting is found by entering the Administrator and selecting Server Settings > Mail Server. With ColdFusion 5, it is located at Server Settings > Mail/Mail Logging.

The mail() function is built into PHP, so the only configuration necessary is in the PHP.ini file. If the web space is hosted, the configuration is completed for you. However, if you’re testing on your own development server, you’ll need to adjust a couple of settings within the [mail function] section of the PHP.ini file. Windows users should set the SMTP setting to your mail server (that is, smtp.myisphost.com), and the sendmail_from variable should be entered as your email address. Macintosh users (connecting through Linux or Unix on OS X) need to set the sendmail_path variable to the location of the sendmail program on your system. You can locate this by opening a terminal window and entering whereis sendmail.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint