0

I am working on a Mailing-List system combined with an online Forum. Mail Input (Via Postfix forward to Script) works and after receiving an E-Mail the script should process it and send it out.

Processing and everything works, sending too.

I Have a list (list@example.com) that is accessible for few adresses (eg user1@ user2@ user3@example.com and user1@ user2@ user3@otherdomain.com)

If one user sends a mail to the list it is delivered t oa php script, that does the processing (Checking if user has rights, adding some Information to the Message eg. sign out link) and sends the mail out to the list-recipients.

But I want to have a behaviour like this for the from the script Outgoing mail:

  • From is original Sender
  • To in the mail is the Mailing list (list@example.com)[X]
  • Reply To is the mailing list
  • Subject is Modified
  • Body is modified
  • Real To is the receiver of the list.

Here's the problem: [X] So I want to send out a Mail, that just delivers to bcc and not to to, but has a to address.

I am Using swift-mailer in Codeigniter.

If I'll send it to the list itself, I would create a infinite loop, because all mails to the list

keykiller91
  • 135
  • 1
  • 1
  • 6

1 Answers1

0

The To field indicates a recipient. To not have a To recipient, leave the To field empty.

In order to workaround this and include a To field that will not be a recipient, I believe some lists use a X-BeenThere header:

X-BeenThere: listaddress@domain.org
To: listaddress@domain.org

Then when the list receives the email back — which it will do along with all your BCC "real" recipients — it can simply ignore it because X-BeenThere matches its address. This prevents the loop.

I do not know how standard this is, whether Swift-Mailer supports it and if not how to make it so. I observed this precedent with the gpsd-users list.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
  • So you mean, I should send the mail to the List and set an additional header and when my list handler sees that header, it ignores the mail? In that Case I have a complexity of 2n instead of n, beause every e-mail has to be parsed n+1 times. (The real mail + every fake mails with X-BeenThere. Would be a acceptable solution if I find no other one. Thanks! – keykiller91 Oct 28 '12 at 16:57
  • 1
    @keykiller91: That's what I mean yes. And `n+1` does not lead to a complexity of `O(2n)` at all. It is still `O(n)` (since we ignore both coefficients and lower-order constants). If one extra email dispatch is your bottleneck then I suggest you have some serious underlying problems that should be solved first. – Lightness Races in Orbit Oct 28 '12 at 17:50
  • 1
    ah... you mean not per recipient. you mean send more than one bcc at once ;-) Ok. got it. had a terrible weekend. – keykiller91 Oct 28 '12 at 21:45
  • @keykiller91: Oh, that's a given! But even if that weren't the case, adding one more recipient would not suddenly change the complexity of the solution. – Lightness Races in Orbit Oct 28 '12 at 23:39