Gossamer Forum
Home : Products : DBMan : Customization :

automatic email

Quote Reply
automatic email
When a new user signs up and creates a new record, filling out his email address in one field, is it possible to send him, automatically a "welcome" message to check his email address ? Thanks.
Quote Reply
Re: automatic email In reply to
Yes there is, under the sub signup section you can place the following code.

# Add the userid into the file with default permissions.
Code:
open (PASS, ">>$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) {
flock(PASS, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
my @salt_chars = ('A' .. 'Z', 0 .. 9, 'a' .. 'z', '.', '/');
my $salt = join '', @salt_chars[rand 64, rand 64];
my $encrypted = crypt($in{'pw'}, $salt);
my $permissions = join (":", @auth_signup_permissions);

print PASS "$in{'userid'}:$encrypted:$permissions\n";
close PASS;

&html_signup_success;

open(LAST, ">>$latest") | | die $!;
print LAST "Userid: $in{'userid'}\n";
print LAST "Pass: $in{'pw'}\n";
print LAST "Email: $in{'Mail'}\n\n";
close(LAST);

use NET::SMTP;
$smtp = Net::SMTP->new('your.SMTPSERVER.net'); # connect to an SMTP server
$smtp->mail( 'yourname\@yourdomain.net' ); # use the sender's address here
$smtp->to($in{'Mail'}); # recipient's address
$smtp->data(); # Start the mail

# Send the header.
$smtp->datasend("To: $in{'Mail'}\n");
$smtp->datasend("From: yourname\@yourdomain.net\n");
$smtp->datasend("BCC: yourname\@yourdomain.net\n");
$smtp->datasend("Subject: Your Access Information\n");
$smtp->datasend("\n");

# Send the body.
$smtp->datasend("Thank You for registering with us.\n");
$smtp->datasend("Please save this message!\n");
$smtp->datasend("This information is REQUIRED to add/modify/delete your account info!\n");
$smtp->datasend("Please let others know of this service!\n");
$smtp->datasend("Your ID, Password and E-Mail are:\n");
$smtp->datasend("Userid: $in{'userid'}\n");
$smtp->datasend("Pass: $in{'pw'}\n");
$smtp->datasend("E-Mail: $in{'Mail'}\n");
$smtp->datasend("\n");
$smtp->datasend("\n");
$smtp->datasend("\n");
$smtp->datasend("\n");
$smtp->datasend("Thank you for your time and good luck.\n");
$smtp->datasend("Your Name Here\n");


$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection
}


The BCC: Function is not working correctly but the mail does go out.

You will also need to add a E-mail section to your creat an account screen.


------------------
Thanks in Advance

Daniel J.
www.blackrose.net
webmaster@blackrose.net

[This message has been edited by SirDaniel (edited January 31, 1999).]
Quote Reply
Re: automatic email In reply to
SirDaniel,
Thank you very much for your answering to my post.
Unfortunately......that does not work ! : i have a 500 error.
Just a question what is this LAST file you refer to ?
Here is the code i have customized for my site. Do you see an error ?
I must add that i have a field for the email address : its name : Email, declared both in the config file and the form to create the record :

Here is the code

(i have commented the section with the LAST file, but it still doesn't work :


#open(LAST, ">>$latest") | | die $!;
#print LAST "Userid: $in{'userid'}\n";
#print LAST "Pass: $in{'pw'}\n";
#print LAST "Email: $in{'Email'}\n\n";
#close(LAST);
use NET::SMTP;
$smtp = Net::SMTP->new('mail.noosph.org'); # connect to an SMTP server
$smtp->mail( 'noosph\@noosph.org' ); # use the sender's address here
$smtp->to($in{'Email'}); # recipient's address
$smtp->data(); # Start the mail
# Send the header.
$smtp->datasend("To: $in{'Email'}\n");
$smtp->datasend("From: noosph\@noosph.org\n");
$smtp->datasend("BCC: noosph\@noosph.org\n");
$smtp->datasend("Subject: Your Access Information\n");
$smtp->datasend("\n");
# Send the body.
$smtp->datasend("Thank You for registering with us.\n");
$smtp->datasend("Please save this message!\n");
$smtp->datasend("This information is REQUIRED to add/modify/delete your account info!\n");
$smtp->datasend("Please let others know of this service!\n");
$smtp->datasend("Your ID, Password and E-Mail are:\n");
$smtp->datasend("Userid: $in{'userid'}\n");
$smtp->datasend("Pass: $in{'pw'}\n");
$smtp->datasend("E-Mail: $in{'Email'}\n");
$smtp->datasend("\n");
$smtp->datasend("\n");
$smtp->datasend("\n");
$smtp->datasend("\n");
$smtp->datasend("Thank you for your time and good luck.\n");
$smtp->datasend("Parsifal\n");
$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection
Quote Reply
Re: automatic email In reply to
My apologizes, I forgot that that was there as well. It is a text file that is writen to th edir so that you will have a copy of the information they entered. In db.pl or db.cgi (which ever one you use.) add this line at the top.
Code:
# Get the information to send to them later if it is forgotten.
$latest = $db_script_path . "/saveme.txt";




------------------
Thanks in Advance

Daniel J.
http://www.blackrose.net
webmaster@blackrose.net
Quote Reply
Re: automatic email In reply to
I must also add that this is my set up on my Windows NT Server.. You also need to have libnet installed. You can get it at

http://www.perl.com/CPAN

Installing it is very easy.

------------------
Thanks in Advance

Daniel J.
www.blackrose.net
webmaster@blackrose.net


Quote Reply
Re: automatic email In reply to
Ah!...here is the answer !
i wondered why this does not work for me. My server uses Linux.(RedHat), and usually, to send email, the perl cgi use sendmail.
Anyway, i'll try to grasp some help to translate your code in another one suitable for Unix.
Thanks....
Parsifal