CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Perl/CGI Email

 



rmitchell12
New User

Jul 20, 2012, 1:12 PM

Post #1 of 2 (1263 views)
Perl/CGI Email Can't Post

Having a problem opening an html file, saving the data into an array and then sending an email with the array as the email message (in html format). Heres what I have:

#!/usr/bin/perl
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);

print header;

open FILE, "<", "newsletter.html" or die $!;
my @data = <FILE>;

my $owner_email="robert\@businessinnovationsmo.com";
my $mailprog="/usr/sbin/sendmail";


open (MAIL, "|$mailprog -t") || die "Can't open mail program\n";

#to start writing the email
print MAIL "To: $owner_email\n";
print MAIL "Reply-To: noreply\@nonprofitinsight.com\n";
print MAIL "From: noreply\@nonprofitinsight.com\n";
print MAIL "Subject: Whatever you want, helpful for filtering\n\n";





print MAIL <<"MailBody";

this is @data

MailBody

close(MAIL);
close FILE;
print "Message has been sent";

Thanks in advance for any help!


wickedxter
User

Jul 26, 2012, 6:41 PM

Post #2 of 2 (1209 views)
Re: [rmitchell12] Perl/CGI Email [In reply to] Can't Post


Code
#!/usr/bin/perl 
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);

print header;

open FILE, "<", "newsletter.html" or die $!;
my @data = <FILE>;

my $owner_email="robert\@businessinnovationsmo.com";
my $mailprog="/usr/sbin/sendmail";


open (MAIL, "|$mailprog -t") || die "Can't open mail program\n";

#to start writing the email
print MAIL "To: $owner_email\n";
print MAIL "Reply-To: noreply\@nonprofitinsight.com\n";
print MAIL "From: noreply\@nonprofitinsight.com\n";
print MAIL "Subject: Whatever you want, helpful for filtering\n\n";





my $message = <<MailBody;

this is @data

MailBody

print MAIL $message;

close(MAIL);
close FILE;
print "Message has been sent";



(This post was edited by wickedxter on Jul 26, 2012, 6:41 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives