Advertisement

03.13.2007 at 07:14PM PDT, ID: 22447820
[x]
Attachment Details

I'm stuck -- Perl e-mail sending duplicates

Asked by marcparillo in Simple Mail Transfer Protocol (SMTP), Perl Programming Language, SendMail Email Server

Tags: perl, email, mail

I've written this simple Perl code to extract the email addresses from a database and send an e-mail to each address individually using the standard Unix sendmail prog.  However, when I run it, I get double e-mails everytime, to each address.

There are no duplicate e-mails in the database.  I've tested the output of the loop and I don't get any duplicates -- but I get double e-mails in my inbox.

Any thoughts?
$marc



#SUBROUTINE SENDS E-MAILS
sub sendEmail {

# the body of the e-mail and the subject are
# read from an incoming array
($emailHTML,$subject) = @_;

# read all the e-mail addresses from the database
my $request = $dbh->prepare("SELECT email from emaildatabase where job = 'test' order by location");
$request->execute();
while (($email) = $request->fetchrow) {
push @indata,"$email";
}

for ($j=0;$j<=$#indata;$j++) {
open (MAIL, "|$mailprog -t -oi") || die "Can't open mail program\n";
print MAIL "To: $indata[$j] \n";
print MAIL "From: myemailaddress@domain.com\n";
print MAIL "Subject: $subject\n";
print MAIL "MIME-Version: 1.0\n";
print MAIL "Content-type: text/html;\n\n";
print MAIL $emailHTML;
print MAIL "\n\n";
close MAIL;

}
}Start Free Trial
[+][-]03.13.2007 at 07:21PM PDT, ID: 18715484

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Simple Mail Transfer Protocol (SMTP), Perl Programming Language, SendMail Email Server
Tags: perl, email, mail
Sign Up Now!
Solution Provided By: teraplane
Participating Experts: 4
Solution Grade: A
 
 
[+][-]03.13.2007 at 07:26PM PDT, ID: 18715505

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 07:29PM PDT, ID: 18715513

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 07:32PM PDT, ID: 18715530

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 07:42PM PDT, ID: 18715601

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 07:58PM PDT, ID: 18715702

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 10:59PM PDT, ID: 18716335

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.14.2007 at 05:45AM PDT, ID: 18717825

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.14.2007 at 11:03AM PDT, ID: 18720664

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.14.2007 at 11:07AM PDT, ID: 18720700

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.14.2007 at 11:33AM PDT, ID: 18720876

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.14.2007 at 02:39PM PDT, ID: 18722536

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.14.2007 at 02:58PM PDT, ID: 18722629

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.15.2007 at 08:52AM PDT, ID: 18727953

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.16.2007 at 06:29AM PDT, ID: 18734546

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.16.2007 at 06:46AM PDT, ID: 18734648

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.16.2007 at 07:26AM PDT, ID: 18734972

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.16.2007 at 07:48AM PDT, ID: 18735193

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.16.2007 at 07:48AM PDT, ID: 18735202

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32