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
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.
Related
I'm sending emails with PHPMailer. When an email is bounced it goes to an account like this: account_bounces#domain.com
Inside my email client where I manage this account (account_bounces#domain.com), I have the option to adds filters in order to redirect an email to any other email account, based on the comparation of fields like "Subject", "From", "To" and so on. That's good.
The problem is that the bounced email loses all of my headers/Subject...that I set with PHPMailer because it's ALWAYS composed by the server as it follows:
Subject: Undelivered Mail Returned to Sender
From: MAILER-DAEMON#llsd409-a04.servidoresdns.net
To: account_bounces#domain.com
Date: Today hh:mm
So I have no guide marks to use for adding a filter.
So, is there any way to set a mark(like a custom header, etc...) in PHPMailer that REMAINS in the bounced email?. For example, something like having this:
Subject: Undelivered Mail Returned to Sender (bounce_redirect)
So the word "bounce_redirect" in the Subject(or wherever) would indicate my email client that this email has to be redirected.
Thanks in advance.
Unfortunately there is no way you can force this issue in headers; The only way around it is to use VERP addressing, which is the only way that you can guarantee that it preserves info about the message and what address it was originally sent to. It's common for MS Exchange to send bounce messages that do not mention the original address the message was sent to at all, so VERP is the only solution.
For your example, a typical VERP address would be:
account_bounces-user=domain.com#domain.com
You mail server would be set to spot the account_bounces prefix and remove it, and convert the = to a # in the local part to extract the original address.
In PHPMailer you would set this as your Sender property, like:
$mail->Sender = 'account_bounces-user=domain.com#domain.com';
This will be used as the SMTP envelope sender, and converted to a Return-Path
header by the receiving server, and thus will be used as the RCPT TO address (the bounce destination) when the message gets bounced.
You can take this further and embed additional info in the Sender address that can be used to identify the mailing list, a specific mailshot etc.
I am writing a mailing List in php and need a way to force while sending a mail via smtp (Postfix) on localhost just really sending that mail to the BCC receivers.
(Having To and Cc headers sending them in the mail, but not sending the mail TO them)
The reason: If a mail is sent to the list it was sent to those receivers before; In the php script, I edit the mail (Removing forbidden Words, adding a footer with signout-link etc.) and want to send it than via smtp (mail() isnt good, it does no error handling)
Is there any Class or simple way to do that? or is it possible to stay in the postfix queue (The Mail is piped to the php-script)
The Mail, I send has as to: the mailing.list-adress (Because it has to be shown that the mail was delivered to the mailing list) and all other Tos, but the script should not send them to that adresses, it just should send to the bcc adresses.
The Mail-Flow is
Sender => specific-list#server.de => lists#server.de => php-programm => drop
Every 5 Minutes (Or other time the user specified) the List will be rolled out:
mail in database => script => receipients as bcc, to is list-adress (specific-list#server.de)
The Mail looks like:
From: original-sender#original-server.org
To: specific-list#server.de, <any other tos from original mail>
Cc: <any ccs from original mail>
Bcc: <all the list subscribers> //JUST REALLY SEND TO THIS ADRESSES
Subject: [Listname | Topicid] Topic Name
Content:
<original content>
--
signature for unsubscribe, etc.
I have an Idea how I could solve this, but need help for doing it.
I create a internal mail-address, that forwards to my real receipients
I send the mail to that address
Postfix has to handle that mail not as an outgoing mail but as a new mail delivered to that adress.
Because it is a received mail, postfix doesnt deliver to all other Receivers, it just delivers to that specifix address (that is a Forwarding)
Whenever you send mail, by the rules established universally, you need to have a To recipient. If you want to send the mail to yourself or to an address just for the purpose, fine. Once you have a To you can go ahead and create your bccs.
I am working on a PHP based mailing list using PHPmailer.
Currently I have implemented two options for answers to mailing list posts: reply to sender only Vs reply to list. This basically controls which address is inserted in the Reply-To field.
I want to create the behaviour which my users know from Mailman, here an example:
SenderA posts a message:
From: senderA#foo.bar
To: list#foo.bar
The mailing list forwards it to all recipients, e.g. here to RecipientA:
From: senderA#foo.bar
To: recipientA#foo.bar
CC: list#foo.bar
Now RecipientA replies to the post and the reply looks like that:
From: recipientA#foo.bar
To: senderA#foo.bar
The other option RecipientA has is posting the reply to the whole mailing by choosing "reply to all" in the mail client which looks like that in the reply:
From: recipientA#foo.bar
To: senderA#foo.bar
CC: list#foo.bar
When I would decide to set the mailing list's address in the CC field for all forwarded mails:
Does that mean the mail comes back to the mailing list 100 times when I send out the mail to 100 subscribers (-> it would cost quite a lot of performance to retrieve, check and drop that duplicate mails)
Can I include a certain header so that the mail to the CC'd mailing list is not send 100 times? How can I tell the mail server(s) to not do that?
Or:
Is there an alternative way to allow the users to decide to reply to the sender or to the whole list?
I figured it out - most email clients will treat replying to mailing list emails as desired when the following conditions are met for the outgoing mailing list emails:
The emails come with the standard mailing list headers according to RFC 2369, you definitely need List-Post with something like <mailto:list#foo.bar>
For replies only to the sender you either need a correct set From header field (must be the email of the sender, recipientA#foo.bar in the example) or the Reply-To header field in case you cannot change the From field
This is slightly different from the Mailman approach but it works very well and you can be sure that your server does not have to deal with unwanted duplicates
I have a web page that generates several email addresses. I need to be able to click on a link, which will open an email client such as outlook and populate the bcc field with those email addresses. In the past, we have used html's mailto, which achieves this goal perfectly.
My problem now is that I need to send emails to over 200 people, and mailto cannot handle that much information. Since the page also uses PHP, I have considered PHP's mail() and phpmailer(), but since both require that the entire email be generated on the page and the email client is never opened, they will not work.
Does anybody know of an alternative method I can implement to achieve this functionality?
Create a mailing list, add those e-mails to the mailing-list and send mail there instead.
As a bonus, you can use VERP to prune invalid addresses.
I don't think there is a convenient alternative method.
You could offer a textarea field containing all the addresses in a comma-separated list. That list could be easily copy+pasted into the client's E-Mail program.
If the client's E-Mail is on the same domain as the web site, and you have full control over your server, you could randomly generate E-Mail addresses on your server using PHP:
1293820239453202349#example.com
that E-Mail address would be configured to forward incoming mail (that your user with the mail client writes and sends to that one random address) to the big list of recipients. This is a very advanced method but hard to implement.
Maybe you can make an email group, depending on your mail system, such that when you send a mail to the address of the group, it will distribute to all members?
On our company, we have several groups. all#company.com, sales#company.com, developers#company.com etc. Sending one e-mail to such an address will make all members of the respective group receiving it.
MailTo with a Copy
<a href="mailto:astark1#unl.edu?cc=ASTARK1#UNL.EDU">
MailTo with a Blind Copy
<a href="mailto:astark1#unl.edu?bcc=ASTARK1#UNL.EDU">
I recently had to move servers. On the old server, I had a Mailman listserv distribution list, but since Mailman was not supported on the new server, I wrote up a PHP script to read messages from IMAP and resend via SMTP. The script is brittle (my fault) and complex (not my fault): I'm having to parse each message, find the bits that I can use (if it's multi-part or HTML or it has attachments), and then reconstruct the message for SMTP so that each member except the sender gets a copy and the Reply-To is the distribution list address. The thing is, I know that the raw source of the message is fine as is. I just need to change/add a few headers.
On Windows servers, you can configure an email dropbox folder where you could save outgoing mail messages in their raw form. Is there anything similar on *nix? Is there any other method I should look at?
I know I can set up a forwarder address on the server, but I really like the behavior of listserv systems: senders don't get a copy of their own message, the subject is identified with the list's label and hitting "Reply" sends a message back to the distribution list, not the original sender.
In order to create your own bespoke list server system you'll need to do the following:
Configure your mail server to have an alias such as no-reply#yourdomain.com to redirect messages to black-hole or /dev/null or something like that, basically deleting any messages on arrival without returning NDR (non-delivery report) email messages to senders. This is the address your script will use in the To: header of your email messages when sending to the group.
Write your PHP script section that sends to the group in such a way that: (a) first pulls all your subscribers out of a database (or securely stored data file) into an array, (b) next remove the message author's address from the array, (c) then finally loop through all the remaining subscribers in the array in batches of about 15 recipients and send the message with the mail() function using To: "Your List Name" <no-reply#yourdomain.com and the BCC: (blind carbon copy) field to prevent receipients seeing who else is on the list.
If you're wanting to try out some of the existing solutions for this why not take a look at
Majordomo.