Gossamer Forum
Home : Products : DBMan : Customization :

mail a record

Quote Reply
mail a record
I'm looking for a mail a record routine, so I could be able to mail shown record.

Tnx.
Quote Reply
Re: mail a record In reply to
Mail it to whom?


------------------
JPD





Quote Reply
Re: mail a record In reply to
Mail it to a given address. Something like mail a user mod, but this should send some info too. I know how to maike it out of mail-a-user mod, but i don't know how perl initializes variables.

Quote Reply
Re: mail a record In reply to
I'm not familiar with mail a user mod, so this will be my own version of how to do it.

Do you want to have a form on each record to enter the email address or do you want to go to a separate form?

------------------
JPD





Quote Reply
Re: mail a record In reply to
 
Below is send-mail mod. What I'm wondering is if I could send some other fileds from the record the e-mail address has been taken from. So, my wuestion is, does %rec = &get_record($in{$db_key}); use all the fields ?!? Tnx.

-------------send-email-mod---------
sub send_email {
unless ($in{'email'}) { $message = "Morate unijeti svoj e-mail<BR>"; }
unless ($in{'email'} =~ /.+\@.+\..+/) { $message = "Vasa e-mail adresa nije u valjanom formatu. Provjerite upis!<BR>"; }
unless ($in{'subject'}) { $message .= "Morate unijeti Subject poruke!.<BR>"; }
unless ($in{'emailmessage'}) { $message .= "Vase e-mail polje ne smije biti prazno!.<BR>"; }
%rec = &get_record($in{$db_key});
if (!%rec) { $message .= "e-mail adresa na koju zelite poslati mail ne postoji.<BR>"; }
if (!$rec{'mail'}) { $message .= "Doticna osoba ne posjeduje e-mail.<BR>" }
if ($message) {
chomp($message);
&html_send_email_form($message);
return;
}
open (MAIL, "$mailprog") | &cgierr("unable to open mail program");
print MAIL "To: $rec{'mail'}\n";
print MAIL "From: $in{'email'}\n";
print MAIL "Subject: $in{'subject'}\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL $in{'emailmessage'};
print MAIL "\n\n\n" ;
print MAIL " \n";
close (MAIL);
&html_send_email_success($rec{'Ime'});
}
Quote Reply
Re: mail a record In reply to
Yep. The line

%rec = &get_record($in{$db_key});

puts all the values of the fields for the record identified by the key value that was entered into the %rec hash. You can use them in your email message however you want.


------------------
JPD