Gossamer Forum
Home : Products : Links 2.0 : Customization :

how to send email to two contact emails?

Quote Reply
how to send email to two contact emails?
I have the need of use more than one contact email but I've not understand where to place an eventualy second email...
Can anyone help me?
Thanks in advance for your time.
Quote Reply
Re: how to send email to two contact emails? In reply to
Have you added a second email field in the links.def? If not...then your first step is to click on the Resource Center link, then click on the Links link, then click on the FAQ link, then click on Links2.0 link...there is a FAQ about adding fields to your links.def...that is the first thing you need to do.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: how to send email to two contact emails? In reply to
I have added the field but the mail procedure is to complex for me to understand where I have to add the second email address in the smtp delivery procedure...
Quote Reply
Re: how to send email to two contact emails? In reply to
And in which script do you want to send a second email message? To the Link Owners in the admin.cgi script? Or in the add.cgi file? Or in the modify.cgi script?

Please be more specific.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: how to send email to two contact emails? In reply to
add.cgi and modify.cgi
What I need for the modification is:
use more than one email field and have a modificable text for the validate option like the deny
Quote Reply
Re: how to send email to two contact emails? In reply to
Okay...actually, since you want the email to be sent to users when they add and modify links, you will need to edit the admin_html.pl file and the db.pl file.

Try the following:

1) Edit the sub validate_records in the db.pl file.

Find the following codes:

Code:
if ($db_email_modify) {
ID: foreach $id (keys %modify_list) {
if ($modify_list{$id}) { next ID; }
elsif (${$links{$id}}{'Contact Email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ | |
${$links{$id}}{'Contact Email'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}
else { &html_modify_email (%{$links{$id}}); }
}
}
if ($db_email_add) {
ID: foreach $id (keys %validate_list) {
if ($validate_list{$id}) { next ID; }
elsif (${$links{$id}}{'Contact Email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ &#0124; &#0124;
${$links{$id}}{'Contact Email'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}
else { &html_validate_email (%{$links{$id}}); }
}
}

Replace them with the following:

Code:
if ($db_email_modify) {
ID: foreach $id (keys %modify_list) {
if ($modify_list{$id}) { next ID; }
elsif (${$links{$id}}{'Contact Email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ &#0124; &#0124;
${$links{$id}}{'Contact Email'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}
elsif (${$links{$id}}{'SecondEmail'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ &#0124; &#0124;
${$links{$id}}{'SecondEmail'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}


else { &html_modify_email (%{$links{$id}});
if ($($links{$id}){'SecondEmail'}) {
&html_modify_second_email (%{$links{id}});
}
}

}
}
if ($db_email_add) {
ID: foreach $id (keys %validate_list) {
if ($validate_list{$id}) { next ID; }
elsif (${$links{$id}}{'Contact Email'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ &#0124; &#0124;
${$links{$id}}{'Contact Email'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}
elsif (${$links{$id}}{'SecondEmail'} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ &#0124; &#0124;
${$links{$id}}{'SecondEmail'} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {
$errstr .= ($errstr, "<li>Email Error: <strong>$id</strong>. Record validated, but couldn't send auto email. Reason: Bad Email addres: '${$links{$id}}{'Contact Email'}'.");
}


else { &html_validate_email (%{$links{$id}});
if ($($links{$id}){'SecondEmail'}) {
&html_validate_second_email (%{$links{id}});
}
}

}
}

Notice the bolded codes...these are new and edited codes. Also you will have to change the 'SecondEmail' with the field name of your second email address.

2) Create the following new sub-routines in your admin_html.pl file:

sub html_modify_second_email

Code:
sub html_modify_second_email {
# --------------------------------------------------------
# All the link information is stored in %link.
my (%link) = @_;

# Set the to, from, subject and message to send.
my $to = $link{'SecondEmail'};
my $from = $db_admin_email;
my $subject = "Your link has been added!";
my $msg = &load_template ('email-mod.txt', \%link);

# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or
&cgierr("Unable to init mailer! Reason: $Mailer::error");
$mailer->send or &cgierr ("Unable to send modification message. Reason: $Mailer::error");
}

AND

sub html_validate_second_email

Code:
sub html_validate_email {
# --------------------------------------------------------
# All the link information is stored in %link.
my (%link) = @_;

# Set the to, from, subject and message to send.
my $to = $link{'SecondEmail'};
my $from = $db_admin_email;
my $subject = "Your link has been added!";
my $msg = &load_template ('email-add.txt', \%link);

# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or
&cgierr("Unable to init mailer! Reason: $Mailer::error");
$mailer->send or &cgierr ("Unable to send addition message. Reason: $Mailer::error");
}

Again, Change SecondEmail with the second email address field name in your links.def file.

Hope this works and helps.

BTW: Remember to bookmark this Thread, so that you can refer to it later.

Regards,


------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: how to send email to two contact emails? In reply to
And do you have any idea on how to allow the admin use the same memo area of the delete option for the validate?
Quote Reply
Re: how to send email to two contact emails? In reply to
In English, please?

What are you referring to? "memo"?

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: how to send email to two contact emails? In reply to
in the admin area
when you validate a link if you choose to delete a link you can modify the text email but the validate link text is always the same... I need the opportunity to modify the text for every validation.
Quote Reply
Re: how to send email to two contact emails? In reply to
Search the forum...There is a Thread that provides codes for doing this! Look for the user DogTag!

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: how to send email to two contact emails? In reply to
CGI ERROR
==========================================
Error Message : Unable to send addition message. Reason: No To: field specified.

I get this error but the emails have been sent.
No messages from DogTags about the validation message...
Thanks for all your time...

[This message has been edited by Marco Volpe (edited February 15, 2000).]
Quote Reply
Re: how to send email to two contact emails? In reply to
The problem is that you probably forgot to change the SecondEmail field as I recommended for the new sub-routines in the admin_html.pl file.

Also, the if and else conditional statements I added does check to see if there is a Second Email Address.

Look at the codes again, and check to make sure that you have customized the codes to work with your links.def file (in terms of field names).

The error message you are receiving shows that one of the following reasons:

1) Either you have not changed the field appropriately to the second email field NAME in your database.

2) There is no Second EMAIL address for the records that you tested this code hack with.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------