Gossamer Forum
Home : Products : DBMan : Customization :

change password,how to send fonfirm mail

Quote Reply
change password,how to send fonfirm mail
Hi, I use http://www.jpdeni.com/dbman/Mods/sec_chg_pass_uf.txt
change password mod,users always forgot that they haved changed their password and someday they try to login again with old password that included in innitial signup email confirm.So it's not success to login.
I'd like to send email sending new password confirm to his email address.hOW TO?


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: change password,how to send fonfirm mail In reply to
Try inserting the following codes after the line in sub change_password in db.cgi:
print PASS "$userid:$encrypted:$view:$add:$del:$mod:$admin:$email\n";
close PASS;

>>Insert new codes
open (MAIL, "$mailprog") || &cgierr("Can't start mail program");
print MAIL "To: $in{'email'}\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $html_title New Email Address and Password\n\n";

print MAIL "-" x 75 . "\n\n";

print MAIL "Confirm change of New password.\n\n";
print MAIL "Your StudentID at $html_title is: $userid\n";
print MAIL "Your new Password is: $password\n";

print MAIL "Please keep this email for future reference.\n\n";

print MAIL "To log on, go to\n\n";
print MAIL "$db_script_url?db=$db_setup\n";
print MAIL "and enter your User ID and password.\n\n";

print MAIL "Please contact $html_title support at: $admin_email\n";
print MAIL "if you have any questions.\n\n";

It should work. I don't have this code inserted in that subroutine but I have that code inserted in sub change_email

Julian
Quote Reply
Re: change password,how to send fonfirm mail In reply to
:-( i did not work for me.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: change password,how to send fonfirm mail In reply to
You need to tell me what is it that did not work. Like no mail was sent? No data was sent in the email? I need to know what errors were generated before I can tell you how to correct it.

Julian
Quote Reply
Re: change password,how to send fonfirm mail In reply to
hi, sorry :)
I added the code and then try change password ,but i got no email in my box.

Thank you .


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: change password,how to send fonfirm mail In reply to
Stupid me. Should have seen the error earlier. change $in{'email'} to $email.

Try it.

Julian
Quote Reply
Re: change password,how to send fonfirm mail In reply to
it did not work,i have do changed it to $email.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: change password,how to send fonfirm mail In reply to
Do you have any mods that would email to any user of the database? If yes, then I have to think about the problem. If not, that would explain the problem. You will need to define $mailprog your default.cfg file.

$mailprog = "|/usr/sbin/sendmail -t -oeq"


Julian
Quote Reply
Re: change password,how to send fonfirm mail In reply to
yes, I have change email ,and lost secure password lookup mod installed.Also
$mailprog = "|/usr/sbin/sendmail -t -oeq"
was in .cfg file.


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: change password,how to send fonfirm mail In reply to
Opps... Now I see my error. I use my own database to verify that it works. Can you delete the entire portion of the mailing code I gave you and then add the new codes I wrote below between the 2 lines in red:

print PASS "print PASS "$userid:$encrypted:$view:$add:$del:$mod:$mem:$admin:$email\n";
>>Insert Code here
close PASS;

Code to be inserted:

open (MAIL, "$mailprog") || &cgierr("Can't start mail program");
print MAIL "To: $email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $html_title New Password\n\n";

print MAIL "-" x 75 . "\n\n";

print MAIL "Confirm change of New password.\n\n";
print MAIL "Your StudentID at $html_title is: $userid\n";
print MAIL "Your new Password is: $in{'pw1'}\n";

print MAIL "Please keep this email for future reference.\n\n";

print MAIL "To log on, go to\n\n";
print MAIL "$db_script_url?db=$db_setup\n";
print MAIL "and enter your User ID and password.\n\n";

print MAIL "Please contact $html_title support at: $admin_email\n";
print MAIL "if you have any questions.\n\n";

Julian
Quote Reply
Re: change password,how to send fonfirm mail In reply to
Julian, this time is work !!!!
Thank you fro your help alot :)

I also want to auto send eamil to record owner if the record been validated.. Need to modi fy the code or just use it same?


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: change password,how to send fonfirm mail In reply to
Different codes to be added to sub validate_records in db.cgi Note that the code is added to the validate records sub and not the subrountine that "validates" whether the form submitted conforms to the rules set out.

Find this line in the sub validate_records in db.cgi:

if ($delete_list{$data[$db_key_pos]} ) {
$delete_list{$data[$db_key_pos]} = 0;

Add this code right after it:

%rec = &array_to_hash(0,@data); # this line allows you to use $rec{'fieldname'} in your message
open (MAIL, "$mailprog") or &cgierr("unable to open mail program");
print MAIL "To: $data[$email_field_number]\n";
print MAIL "From: $admin_email\n";
# you can change the subject line to whatever you want
print MAIL "Subject: $html_title: Record deleted\n\n";
print MAIL "-" x 75 . "\n\n";

# Here's where you create your canned delete message. You can use the $rec{'fieldname'} variables
# just like in sub html_record to include the values of any fields that you'd like to.
# As you define your message, use carriage returns for a newline
$email_message = qq|
Dear $rec{'fieldname'},

I'm sorry, but your application to $html_title is not accepted.

We appreciate your coming by and possibly we can be of assistance to you later.

Sincerely,
Your name here
Your official Title here
$html_title
|;
print MAIL $email_message;
close (MAIL);

Also find this line in the same subroutine:

elsif ($validate_list{$data[$db_key_pos]}) {
$validate_list{$data[$db_key_pos]} = 0;

Add the same codes immediately after the 2 lines above. Note that this part here is to email to the person if you validate his record, the previous one emails if you choose not to validate his record. So you have to make the necessary changes to the email message or else even if you valiadte the person's records he will get an email telling him that his records was not accepted. You wouldn't want that, would you? :)


Julian
Quote Reply
Re: change password,how to send fonfirm mail In reply to
Thank Julian :)))It's work! great. :))


Please Excuse me for my poor knoledge of PERL
Regards,
Act.
Quote Reply
Re: change password,how to send fonfirm mail In reply to
Just glad to be able to help...

Julian