Gossamer Forum
Home : Products : DBMan : Installation :

Send Email when user added

Quote Reply
Send Email when user added
Is it possible to have an Email sent to me when a user has created a new account and added their details.
Step by step details would be appreciated if it is possible.

Nadr
Quote Reply
Re: Send Email when user added In reply to
Hi,

Add:

open (MAIL, "|/usr/lib/sendmail -t") or &cgierr("Can't open sendmail: $!");
print MAIL "To: youraddress\@yourdomain.com\n";
print MAIL "From: DBMan\n";
print MAIL "Subject: New user signup!\n\n";
print MAIL "A new user signed up on ", scalar localtime(), ".\n";
print MAIL "Userid: $in{'userid'}\n";
print MAIL "Pass: $in{'pw'}\n";
close MAIL;

Right after:

&html_signup_success;

in db.cgi (around line 700). Make sure to replace the email address with your own (and don't forget to escape the @).

Hope this helps,

Alex
Quote Reply
Re: Send Email when user added In reply to
Alex, can you get the password after someone has logged in and they have added the info? Isn't the password encrypted?

This would prevent you from sending them a confirmation message to their e-mail address with the username and password yes?
Quote Reply
Re: Send Email when user added In reply to
Yes the password is stored encrypted, but you still have access to it once the user is signing up (because it is sent to the script unencrypted).

Basically here's the process:

1. User goes to sign up form and enters userid and password.
2. sub signup is run and p/w is in $in{'pw'}.
3. encrypted password is generated and printed to password file.

We still have access to the original password though, and can mail the user. Once we are done with this request, the password is lost forever.

Hope that helps,

Alex
Quote Reply
Re: Send Email when user added In reply to
Joop, thank you Alex for this hint - now a "workaround" for the all the time mentioned Lost Password problem is there:

If it is possible to change the User ID into the new users e-mail adress ( of cause with standard e-mail verification *@*.* ) then it would be possible to send a new user a notification containing his user ID = his/ her e- mail and of cause the password. Right ? It would look like:

open (MAIL, "|/usr/lib/sendmail -t");
print MAIL "To: $in{'userid'}\n";
print MAIL "From: Webmaster\n";
print MAIL "Subject: Your New Password!\n\n";
print MAIL "Your ID and Password are\n";
print MAIL "Userid: $in{'userid'}\n";
print MAIL "Pass: $in{'pw'}\n";
close MAIL;

One Problem:
how to change the allowed letter set and to insert a standard e- mail verification at the sign up $in{'userid'}field ? Normally only a-z is allowed !

Additionally if someone do not want to have the e- mail adress as user id it should be possible to create a new field at the new user sign up where the new user will enter his e- mail adress in a new variable like:
$in{'mail'} and then it should be also possible to send a new user his account informations - something like:

open (MAIL, "|/usr/lib/sendmail -t");
print MAIL "To: $in{'mail'}\n";
print MAIL "From: Webmaster\n";
print MAIL "Subject: Your New Password!\n\n";
print MAIL "Your ID and Password are\n";
print MAIL "Userid: $in{'userid'}\n";
print MAIL "Pass: $in{'pw'}\n";
close MAIL;

I am really not an expert in perl but it seems to me logical that something like this will work !!??
Would be nice if someone take care of this :-)

Bye Diemo
Quote Reply
Re: Send Email when user added In reply to
Thanks Alex it works great, But, would the same procedure work when users added details so that I know the actual name of the user . Would it go under sub html_add_success?

Thks

Nadr
Quote Reply
Re: Send Email when user added In reply to
Is it also possible to have both an email sent to the user and to the owner by inserting this action in the same position within the script?

Melvin

------------------
Quote Reply
Re: Send Email when user added In reply to
Diemo, good idea.

What about just requiring an e-mail address at sign-up? I think it would be possible to add an email field to the userid and pw. I play with it tonight.

Email me if you come up with anything first. Smile

-Norm
Quote Reply
Re: Send Email when user added In reply to
It is possible to email both people, just add the same coding with the to field being your email address.
This does work best if you have an extra field when signing up, I have been doing that using a routine I wrote. It helps because they are sent an email that they can then save and refer to if they forget their password.


------------------
Quote Reply
Re: Send Email when user added In reply to
I would be interested in learning how to add more fields to the signup page - ie email, location etc. If this is possible, would it be feasible to have a blurb saying something like "forgot your password, enter your email to have it sent via email". If that is possible and if anyone has done it, let me know.

Thanks.

------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: Send Email when user added In reply to
I too am curious about how to add fields to the signup form and record them in $auth_pw_file.

Has anyone worked this out yet? I'd simply like to add an e-mail address requirement to the signup form, so I can fire off an email to new users when they sign up.

Thanks for any help.

Glen