1

There are already many questions about it, but the answers I found are not clear or contrasting, while the problem, even if stated in many ways, seem IMHO to be a general one (and I have it too).

When you have hundreds to thousands recipients for your email (usually with attachments), which is the best way to follow?

I am using AddBcc (see my code above) but I've met many issues during the year, because many recipients find the mail in the spam, many simply do not receive it (or so they say), many have issues with attachments and so on.

Here the suggestion seem to use a single email with as many AddBcc as the recipients, but here we see that "SMTP RFC (RFC 5321) does not impose any limit on BCC field length, though some ISP may limit it intentionally to prevent spamming." and we find a suggestion to send one mail for recipient.

On the other hand here we find that "I'm pretty sure it's actually built into the email protocol that you can't detect which are successful. Otherwise, this information could be used maliciously to discover email addresses for spamming purposes.", so what can I do to ensure everybody to get their email?

Moreover, here we see someone strongly suggesting one email for recipient, pointing out to the PHPmailer wiki article on sending to lists which says (amongst other interesting things) "If the messages you send are absolutely identical, you can add all the addressees using addBCC(), which will mean you only need to send() a single message, though most mail servers will have a limit on the number of addresses you can send at once."

So, if there is no theoretical limit to Bcc number, but "some" mail servers "may" have a limit on that number, and we cannot even know which email arrived and which not, focusing on reliability, what should I do?

<?php
    // database connection and session init
    require 'main.php';

  //mailer init
 require 'phpmailer/PHPMailerAutoload.php';
  $mail = new PHPMailer;
  $mail->setFrom('myadd@mysite.gov.it');
//query
  $q="SELECT email FROM ".$genitori_table.",".$users_table." WHERE cf_g is not null";
  $q=$q." AND ".$users_table.".id_g1=".$genitori_table.".id AND ".$users_table.".stato=1";

  while($row = $retval->fetch_array()){
      echo $row['email'];
      $mail->AddBCC($row['email']);
      //$mail->addAddress($row['email']);
  }
  $mail->isHTML(true);

  $mail->Subject = 'my subject';
  $mail->Body    = 'my body';
  $mail->AltBody = 'my alt body.';


  $mail->AddAttachment('LetteraAiGenitori.pdf','lettera');
  $mail->AddAttachment('AutorizzazioneUscitaAutonomaAlunni.pdf');

  if(!$mail->send()) {
      echo 'Message could not be sent.';
      echo 'Mailer Error: ' . $mail->ErrorInfo;
  } else {
      echo 'Message has been sent';
  }
?>
massi
  • 200
  • 9
  • The basics of SMTP don't provide you any way of tracking deliverability beyond knowledge of whether or not the handoff occurred. You don't know if the MTA on the other end accepted your payload and then immediately deleted it. Things like spam classification can't be fixed with code, outside of the content of the emails which may or may not be considered spammy. Sorry but your Q is broad and vague but I hope my comment may help you a bit. People use html and tracking urls/pixels etc to try and determine whether something was delivered. Spam score is dependent config of DKIM,SPF,DNS etc. – gview May 30 '19 at 17:42
  • @Muhammad Usman Maybe you shoud read the article I linked before rushing a possible duplicate: in what you report as possible duplicate, there is just a solution that I pointed out in my references (AddAddress) that first can cause other issues (which you did not take into consideration) and second is not conclusive but, not less important, does not say WHY you should use that solution instead of AddBcc for example – massi May 30 '19 at 17:42
  • You’ve explained the situation well, but there doesn’t seem to be a question here. Send either way, as appropriate to your needs, and deal with bounces, which will also occur with BCCs. – Synchro May 30 '19 at 17:45
  • One last thing about optimization: consider that there is an alternative to 1 email. It is 1 email per host. The MTA will require at LEAST that many SMTP connections to other MTA's. So if you group up your emails by destination domain that might be a good strategy. – gview May 30 '19 at 17:45
  • @gview. I did not think it was vague: if I use AddBcc I have issues, but if I use AddAddress I have others and if I send many mails I have still others, which way shall I use if I want reliability? Please point me how to edit – massi May 30 '19 at 17:47
  • You are conflating things (acceptance, tracking, spam scoring) with whether or not you do 1 giant bcc or individual emails. That is the problem... neither addresses any of those problems or requirements. – gview May 30 '19 at 17:56
  • Ok, so I should rephrase with something like "I want to use 1 giant Bcc, but many mails do not arrive, what should I do?". But when someone answer me "send many mails" I should ask "if I do that I am tagged ad spammer, what should I do?" and so on? – massi May 30 '19 at 18:26
  • Using your own server to send that much mail is asking for trouble. Using bcc is a common method used by spammers which is why your recipients are finding it in spam or not getting it all. Using one of the many mass mailing services is a much better option. – Dave May 30 '19 at 18:43

0 Answers0