I had a problem of sending emails with Bcc, and not getting delivered. but today i have read my smtp provider documentation and doesnt allow bcc
so i want to send each email using looping method to send each email separately to avoid recipients seeing other receivers
i have added this to my script to loop
my $RCPT; foreach $RCPT ($tostring) { }
the response is
no recipients
my $AID = "XD4555"; my $query = $dbh->prepare("SELECT snd.EMAIL FROM FUSERS as m JOIN USERS as snd ON snd.USERID = m.USERID WHERE (m.USERID_IM = ?)"); $query->execute($AID); my $user1 = $query->fetchall_arrayref(); my $query_other = $dbh->prepare("SELECT snd.EMAIL FROM FUSERS as m JOIN USERS as snd ON snd.USERID = m.USERID_IM WHERE (m.USERID = ?)"); $query_other->execute($AID); my $user2 = $query_other->fetchall_arrayref(); my $TotalEmails = [ @$user1, @$user2 ]; my @to; for my $em ( @$TotalEmails ) { push @to, @$em; } my $tostring = join ',', @to; my $RCPT; foreach $RCPT ($tostring) { } my $message_s = "<p>hi just test</p>"; my $smtpserver = 'smtp.xxxxxx.com'; my $smtpport = 587; my $smtpuser = 'xxxxx'; my $smtppassword = 'xxxxx'; my $transport = Email::Sender::Transport::SMTP->new({ host => $smtpserver, ssl => 'starttls', port => $smtpport, sasl_username => $smtpuser, sasl_password => $smtppassword, }); my $email_s = Email::Simple->create( header => [ To => $RCPT, From => 'xxx@xxxx.com', Subject => "test hi", 'Content-Type' => 'text/html', ], body => $message_s, ); sendmail($email_s, { transport => $transport });
In reply to sending batch of emails by looping by frank1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |