Hello- basically, I am wondering if it's possible to specify a "To" address but not actually send an email to that address (and instead send it somewhere else).
I am trying to integrate PHPMailer with a Drupal module sometimes used for mailing lists. It seems that when you receive an email from most mailing lists, the "To" header lists the mailing list address (instead of your own address). This is the effect I'd like to mimic. I could do this by actually sending the mail to the mailing list address and BCCing recipients, but I'd prefer not to because this would require the mailing list to filter out messages that it sends to itself (not easy in my case because a completely different module receives such messages before they are eventually sent by mine). I know that this is definitely allowed for in the SMTP protocol (headers have nothing to do with the message envelope), I just don't know if it can be managed with PHPMailer.
This will help you, from the changelog...
Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release
A note on sending bulk emails:
If the email you are sending is not personalized, consider using the
"undisclosed-recipient:;" strategy. That is, put all of your
in the Bcc field and set the To field to "undisclosed-recipients:;".
It's a lot faster (only one send) and saves quite a bit on resources.
Contrary to some opinions, this will not get you listed in spam engines -
it's a legitimate way for you to send emails.
A partial example for use with PHPMailer:
Many email service providers restrict the number of emails that can be sent
in any given time period. Often that is between 50 - 60 emails maximum
per hour or per send session.
If that's the case, then break up your Bcc lists into chunks that are one
less than your limit, and put a pause in your script.
Thanks! That worked great in terms of getting the email sent - however, PHP
exited with the error message "Invalid address: undisclosed-
recipients:;". Any ideas?
Actually it seems to work fine if I simply comment out the AddAddress line.
I'll assume that's the preferred solution? :)
I'm using phpmailer with:
$mail->AddBCC(xxx); //to bunch of emails
But the recipients receive email with blank "To" field without any indication of "undisclosed-recipients" where it should be listed there.
Any idea? Or did I missed out something? Thank you.
Like the previous comment says, just omit the call to AddAddress and the 'undisclosed recipients' bit will happen automaticaly. Also please see the project page for the new home of PHPMailer.