jmingo
asked on
Printing 2 Arrays??
here's my code.. $emailfile string for example would be "test-user1.html, test-user2.html" i want to break them up which i'm doing but how can i print it out??
my @mailnames=split(/ *, */,$mailperson) ;
foreach(@mailnames) {
open(SENDMAIL, "|$sendmail -t") || die "Unable to open sendmail";
print SENDMAIL "to: $_\n";
print SENDMAIL "BCC: $bccemail\n";
print SENDMAIL "CC: $ccemail\n";
print SENDMAIL "from: $fromname <$fromemail>\n";
#print SENDMAIL "Reply-to: $fromname <$fromemail>\n";
print SENDMAIL "MIME-Version: 1.0\n";
print SENDMAIL "subject: $subject\n";
print SENDMAIL "Content-Type: text/html; charset=us-ascii\n\n";
my @filenames=split(/ *, */,$emailfile) ;
open (HTMLFILE, "/usr/home/test/upload/ ?? ? ?? ?? ") || die "can't open HTML file: $!";
while (defined($line = <HTMLFILE>)) { print SENDMAIL $line; }
close (HTMLFILE) || die "can't close HTML file: $!";
}
close(SENDMAIL);
}
thanks
my @mailnames=split(/ *, */,$mailperson) ;
foreach(@mailnames) {
open(SENDMAIL, "|$sendmail -t") || die "Unable to open sendmail";
print SENDMAIL "to: $_\n";
print SENDMAIL "BCC: $bccemail\n";
print SENDMAIL "CC: $ccemail\n";
print SENDMAIL "from: $fromname <$fromemail>\n";
#print SENDMAIL "Reply-to: $fromname <$fromemail>\n";
print SENDMAIL "MIME-Version: 1.0\n";
print SENDMAIL "subject: $subject\n";
print SENDMAIL "Content-Type: text/html; charset=us-ascii\n\n";
my @filenames=split(/ *, */,$emailfile) ;
open (HTMLFILE, "/usr/home/test/upload/ ?? ? ?? ?? ") || die "can't open HTML file: $!";
while (defined($line = <HTMLFILE>)) { print SENDMAIL $line; }
close (HTMLFILE) || die "can't close HTML file: $!";
}
close(SENDMAIL);
}
thanks
{local @ARGV=map{"/usr/home/test/ upload/$_} ,split(/ *, */,$emailfile);
while( <> ){ print SENDMAIL; }
}
while( <> ){ print SENDMAIL; }
}
ASKER
so what does that replace?? what's the complete new code ??
thanks!
thanks!
ASKER
so this code is going to email a html file also right??
That replaces
my @filenames=split(/ *, */,$emailfile) ;
open (HTMLFILE, "/usr/home/test/upload/ ?? ? ?? ?? ") || die "can't open HTML file: $!";
while (defined($line = <HTMLFILE>)) { print SENDMAIL $line; }
close (HTMLFILE) || die "can't close HTML file: $!";
Assuming I understood what you meant to do with that code.
my @filenames=split(/ *, */,$emailfile) ;
open (HTMLFILE, "/usr/home/test/upload/ ?? ? ?? ?? ") || die "can't open HTML file: $!";
while (defined($line = <HTMLFILE>)) { print SENDMAIL $line; }
close (HTMLFILE) || die "can't close HTML file: $!";
Assuming I understood what you meant to do with that code.
ASKER
that code causes an error. the script works when i take out your code... any ideas??? thanks again.
my @mailnames=split(/ *, */,$mailperson) ;
foreach(@mailnames) {
open(SENDMAIL, "|$sendmail -t") || die "Unable to open sendmail";
print SENDMAIL "to: $_\n";
print SENDMAIL "BCC: $bccemail\n";
print SENDMAIL "CC: $ccemail\n";
print SENDMAIL "from: $fromname <$fromemail>\n";
print SENDMAIL "MIME-Version: 1.0\n";
print SENDMAIL "subject: $subject\n";
print SENDMAIL "Content-Type: text/html; charset=us-ascii\n\n";
{local @ARGV=map{"/usr/home/winst orm/public _html/cma/ upload/$_} ,split(/ *, */,$emailfile);
while( <> ){ print SENDMAIL; }
}
close(SENDMAIL);
}
my @mailnames=split(/ *, */,$mailperson) ;
foreach(@mailnames) {
open(SENDMAIL, "|$sendmail -t") || die "Unable to open sendmail";
print SENDMAIL "to: $_\n";
print SENDMAIL "BCC: $bccemail\n";
print SENDMAIL "CC: $ccemail\n";
print SENDMAIL "from: $fromname <$fromemail>\n";
print SENDMAIL "MIME-Version: 1.0\n";
print SENDMAIL "subject: $subject\n";
print SENDMAIL "Content-Type: text/html; charset=us-ascii\n\n";
{local @ARGV=map{"/usr/home/winst
while( <> ){ print SENDMAIL; }
}
close(SENDMAIL);
}
ASKER
changed it to this
{local @ARGV=map "/usr/home/winstorm/public _html/cma/ upload/$_" ,split(/ *, */,$emailfile);
while( <> ){ print SENDMAIL; }
}
works... kinda. but it sends 2 html files to each user. i want to send for ex. test-user.html to user1@here.com and test-user2.html to user2@here.com if i'm passing a URL like this
http://1.1.1.1/test.cgi?user=user1@here.com,user2@here.com&emailfile=test-user1.html,test-user2.html
thanks
{local @ARGV=map "/usr/home/winstorm/public
while( <> ){ print SENDMAIL; }
}
works... kinda. but it sends 2 html files to each user. i want to send for ex. test-user.html to user1@here.com and test-user2.html to user2@here.com if i'm passing a URL like this
http://1.1.1.1/test.cgi?user=user1@here.com,user2@here.com&emailfile=test-user1.html,test-user2.html
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
so if it was in an upload directory i'd put something like this
open (HTMLFILE, "/usr/local/test/upload/<$ filenames{ $_}") || die "can't open HTML file: $!";
???
open (HTMLFILE, "/usr/local/test/upload/<$
???
ASKER
open (HTMLFILE, "</usr/home/winstorm/publi c_html/cma /upload/$f ilenames{$ _}") || die "can't open HTML file: $!";
this did it... thanks so much for your help!!
this did it... thanks so much for your help!!
ASKER
close (HTMLFILE) || die "can't close HTML file: $!";
}