Closed (won't fix)
Project:
Subscriptions
Version:
5.x-1.9
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Oct 2007 at 21:41 UTC
Updated:
31 Mar 2008 at 17:41 UTC
Hi again,
To avoid many small mails, I would like to have one mail with many people in BCC. To achieve this, here is what I did.
I added in the while loop:
$userlist .= $subscriptions->mail . ",";
then before exiting the function, I added:
if (!is_null($body)) {
$headers['Bcc'] = $userlist;
subscriptions_sendmail($subscriptions->name, $from, $mail_subject, $body, $from, $headers);
}It seems to work with most providers, but my syntax might be wrong. If anyone has an idea how I could improve this, I would be very grateful, but in general, I thought it might be a nice feature.
Of course, I modified the e-mail that is been sent slightly, to "unpersonalize" it.
Any help will be greatly appreciated, I hope I could help the community a bit with these little pieces of code.
Felix.
Comments
Comment #1
salvisInteresting idea. Note http://www.faqs.org/rfcs/rfc822.html:
Also, I'd put not just a comma but something like
comma space
or even
comma newline space
between each address, but not after the last!
Of course this would need an option (and a checkbox somewhere) to turn it on or off.
Comment #2
felixsmile commentedThank you for your encouraging follow up and your interesting comments.
Unfortunately, I don't know exactly how the drupal and the php function handle the headers.
First of all, I thought that putting a to-address in the drupal mail function would add a "To:" header automatically, as presently, the subscriptions mail function does not seem to add it. [note that I use the existing header given by the subscriptions module, adding the Bcc: to it]
Now, when I try to use ", " (comma space) as a separator, it does not work flawlessly with the SMTP-Authentication module, when I use ", \n\t" (comma space linebreak tab), it doesn't work either. I think that RFC says I should use a tab in the new line to indicate that it is a continuation of the previous one, correct me if I'm wrong.
I will continue testing this on my server here, if anyone else has got the time to test it too, feel free to do so :) Unfortunately, I'm not firm enough with all the RFCs and the partially buggy implementations on some (usually W*...) servers. I'll keep you up to date!
Thank a lot,
Felix.
Comment #3
felixsmile commentedHi salvis,
Just to finish this discussion off.
With comma space, i.e. with
$userlist .= $subscriptions->mail . ", ";it works quite well, but if you have more than some 100 e-mail-addresses where you want to send the e-mail to, you might get stuck because the mail server might respond that the message has too many recipients.
In conclusion, if you want to use this solution for your mailing, you have to
1) add the two code snippets above (with comma space in the first code snippet) and
2) "unpersonalize" the e-mail that is been sent out, i.e. remove all reference to the user it is been sent to.
However: if you can avoid it, avoid it =D
Have a nice day,
Felix.