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:
Help, with sending email!

 



CuzDesign
Deleted

Oct 1, 2000, 2:05 PM

Post #1 of 3 (252 views)
Help, with sending email! Can't Post

Hello,
Hopefully someone can help me here. I have been at this forever it seems and cannot find the problem.
What I am trying to do is open a data file and read in the email address for each record. After I get the
first I send the email to it and so on for the rest. But for some reason it never sends out the emails. Here is
the code I am using. Any help would be greatly appreciated.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


# Name of webmaster
$name = "Webmaster";

# Webmasters email
$webmasteremail = "webmaster\@cuzzart.com";

# Path to sendmail.
$mail_prog = "/usr/lib/sendmail";

# Path to specials.txt file
$emailinsert="../log_files/specials.txt";

# Path to Log file
$logfile = "../log_files/orderdatalog.dat";

# Open log file
open (DATALOG, "$logfile") &#0124; &#0124; die "Can't Open $logfile";
while(<DATALOG> )
{
($id, $inv, $auth, $when, $transid, $total, $first, $lastname, $address, $city, $state, $zip, $country, $phone, $email) = split(/:/, $_);
foreach ($inv) {
# START TO SEND THE E-MAIL OUT
open (MAIL, "|$mail_prog -t");
print MAIL "To: $email\n";
print MAIL "From: $name <$webmasteremail>\n";
print MAIL "Subject: $first, take a look at this site!\n";
print MAIL "Content-type: text/plain\n\n";

# Print the body of the email
print MAIL "Hello $first,\n ";
open (FIL,$emailinsert) &#0124; &#0124; die "couldn't open $emailinsert";
while (<FIL> ){
$data=$_;
print MAIL "$data";
}
close (MAIL);
}
}
</pre><HR></BLOCKQUOTE>

Thanks in advance.

Ray


swampcrawler
Deleted

Oct 9, 2000, 10:29 PM

Post #2 of 3 (252 views)
Re: Help, with sending email! [In reply to] Can't Post

if the email address ($email) is the last line, it has a newline character (\n), so your To: line is really ending with \n\n"; Try taking off the \n from your To: line, b/c you aren't using chop($email) anywhere.


swampcrawler
Deleted

Oct 9, 2000, 10:30 PM

Post #3 of 3 (252 views)
Re: Help, with sending email! [In reply to] Can't Post

Sorry, should have said last field on each line.

 
 


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

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