Not a specific answer to your question, but for handling bulk mail, I would look at the Mail::Bulkmail module, as it is *very* efficient.
See http://cpan.uwinnipeg.ca/h
Main Topics
Browse All TopicsI have problem in sending bulk mails using perl. email id's are being read from the database which is MySQL.
I'm able to read the email id's from the database and I'm getting the confirmation message stating that the mail has been sent, but actually the mail is not going. But if I send email to only one email Id the mail is going. Please let me know what might be the problem.
thanks in advance
Ashok
Here is the code
----------------------
#! /usr/bin/perl
print "Content-type: text/html \n\n";
require "../../quickpro/config.pl"
require "../../quickpro/sconfig.pl
require "globals.pl";
require "variables.pl";
use CGI::Carp qw/fatalsToBrowser/;
use CGI qw (:standard);
$form=new CGI;
@variables=$form->param;
foreach $variables(@variables){${$
&connect_sql;
$SQL="SELECT * from recipientstemp";
&my_sql;
$i=1;
while($column=$sth->fetchr
{
$id=$column->{'ID'};
$firstname=$column->{'firs
$lastname=$column->{'lastn
$email=$column->{'email'};
$phone=$column->{'phone'};
$url=$column->{'url'};
$company=$column->{'compan
$ipaddr=$column->{'ipaddre
$confirmlink="$DomainURL/c
&personalize;
#print "$id,$firstname,$email,$ip
$email=~s/@/\@/g;
$from=~s/@/\@/g;
if($i==1)
{
$temp=$email;
$i++;
}
else
{
$temp=$temp.",".$email;
print $temp;
}
}
unless(open (MAIL, "|/usr/sbin/sendmail -t"))
{
print "error.\n";
}
else
{
#open (MAIL, "|$sendmail -t") || die "I can't open sendmail\n";
print MAIL "To: $firstname <$temp>\n";
print MAIL "From:$from\n";
print MAIL "Subject:$subject\n";
print MAIL "Mime-Version:1.0\n";
print MAIL "Content-Type:text/plain\;
print MAIL "Content-Transfer-Encoding
print MAIL $message;
close(MAIL);
print "Mail sent";
}
$sth->finish;
$dbh->disconnect;
#print "<a href=$DomainURL/cgi-bin/qu
print qq|
<html>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="$darkcolor" background="$DomainURL/ima
<tr>
<td><img height="60" width="360" src="$DomainURL/images/$my
</tr>
</table>
<center>
<br><br>
<b>Confirmation mail has been sent</b>
</body>
</html>
|;
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Not a specific answer to your question, but for handling bulk mail, I would look at the Mail::Bulkmail module, as it is *very* efficient.
See http://cpan.uwinnipeg.ca/h
Business Accounts
Answer for Membership
by: PeeweePosted on 2005-05-26 at 08:11:10ID: 14086710
Hi ashokguru,
ow_hashref ) tname'};
Shouldn't you be calling send mail each time you fetach a row of data!!
while($column=$sth->fetchr
{
$id=$column->{'ID'};
$firstname=$column->{'firs
etc
call sendmail here.
}
$sth->finish;
$dbh->disconnect;
display html...
presumably it just sends one email which will be the last record retrieved from your sql statement...