The following modification to HTML.pm send an email when a record is added to the db.
The mod works fine, however I want to pull the "to,from,cc &subject" from Field values from the db.
Can anyone please point me in the right direction as to coding/syntax to accomplish this?
sub generate_add_success {
#--------------------------------------------------------------------
# Generate HTML for add success
#
my $tags = GT::Template->tags;
my $home = $tags->{home};
my $hsh = $home->{hsh};
#billd
# Create and Sending
GT::Mail->send (
smtp => 'home.domain.com',
to => 'user1@domain.com',
cc => 'user2@domain.com,
from => 'admin1@domain.com',
subject => 'File Transfer Notice',
type => 'text/html',
msg => $home->{disp}->display ( { values => $hsh }),
) or die "Error: $GT::Mail::error";
# Parsing and sending
my $mail = new GT::Mail (debug => 1);
# Parse an email that is in a file called mail.test
my $parser = $mail->parse ('/billd.txt') or die "Error: $GT::Mail::error";
# Change who it is to
# $parser->set ("cc", 'billd@techtran.com');
# Send the email we just parsed and modified
$mail->send (sendmail => '/usr/lib/sendmail') or die "Error: $GT::Mail::error";
return $home->{disp}->display ( { mode => 'add_success', values => $hsh, extra_table => 0 });
}
The mod works fine, however I want to pull the "to,from,cc &subject" from Field values from the db.
Can anyone please point me in the right direction as to coding/syntax to accomplish this?
sub generate_add_success {
#--------------------------------------------------------------------
# Generate HTML for add success
#
my $tags = GT::Template->tags;
my $home = $tags->{home};
my $hsh = $home->{hsh};
#billd
# Create and Sending
GT::Mail->send (
smtp => 'home.domain.com',
to => 'user1@domain.com',
cc => 'user2@domain.com,
from => 'admin1@domain.com',
subject => 'File Transfer Notice',
type => 'text/html',
msg => $home->{disp}->display ( { values => $hsh }),
) or die "Error: $GT::Mail::error";
# Parsing and sending
my $mail = new GT::Mail (debug => 1);
# Parse an email that is in a file called mail.test
my $parser = $mail->parse ('/billd.txt') or die "Error: $GT::Mail::error";
# Change who it is to
# $parser->set ("cc", 'billd@techtran.com');
# Send the email we just parsed and modified
$mail->send (sendmail => '/usr/lib/sendmail') or die "Error: $GT::Mail::error";
return $home->{disp}->display ( { mode => 'add_success', values => $hsh, extra_table => 0 });
}