PHPMailer or php mail function - show BCC address - email

I'm using PHPMailer to send mails to a clients database when certain events triggers. Obviously I don't want everyone to get the full list of client's emails, so i'm sending those in BCC using PHPMailer. It's working fine, but there is one problem.
The customer that receive the email got nothing in the field of the targeted email. Just blank. Shouldn't he be able to see his own address and own name I'm sending ? It's helpfull for people who are redirecting emails to know which was targeted.
Same goes with PHP native mail() function.
Is there a way to handle this ?
Thanks ahead !

No, that's not how BCC works.
If you receive an email via BCC, your mail client will show you the original recipient's address in the 'to' field, not yours.
This applies to all BCC mails; it has nothing to do with phpMailer.
If you want the recipients to see something in the 'to' field, you need to populate it with a dummy value -- for example, 'donotreply#yourdomain.com'.
It is good to send messages like this via BCC, so you're doing the right thing. But if you really want the end user to see his own email address in the 'to' field, then the only way to do it is to send the message to each user as a separate email, so you use the 'to' field and not 'bcc'. However, this will dramatically increase the load on your mail systems, so it's probably not the answer.

That's the nature of email. When a person is BCC'd, they will only see the To:, From: and CC: fields. The BCC field will hide every single email address, even the recipient's.
From wiki:
There are three ways in which the "BCC:" field is used.
In the first case, when a message containing a "BCC:" field is prepared to be sent, the "BCC:" line is removed even though all of the recipients (including those specified in the "BCC:" field) are sent a copy of the message.
In the second case, recipients specified in the "To:" and "CC:" lines each are sent a copy of the message with the "BCC:" line removed as above, but the recipients on the "BCC:" line get a separate copy of the message containing a "BCC:" line. (When there are multiple recipient addresses in the "BCC:" field, some implementations actually send a separate copy of the message to each recipient with a "BCC:" containing only the address of that particular recipient.)
Finally, since a "BCC:" field may contain no addresses, a "BCC:" field can be sent without any addresses indicating to the recipients that blind copies were sent to someone.

Related

Does the subject named in a List-Unsubscribe mailto address need to be "unsubscribe"?

I've implemented List-Unsubscribe (RFC 2369) for marketing emails we send. I am providing both an unsubscribe email address and an unsubscribe URL. An example of a generated header looks like this:
List-Unsubscribe: <mailto:unsubscribe#myserver.com?subject=unsubscribe>, <https://myserver.com/unsubscribe?email=recipient#email.com>
In the past few email campaigns we've done, it has worked great. There's only one problem. Sometimes we receive unsubscribe requests from email addresses we didn't actually send mail to. I think this happens when the user has multiple email addresses and the email we send is forwarded to some other destination. So we send to user-a#email.com, but the recipient opens it at user-b#email.com. When they click the "Unsubscribe" link provided by their email client, it generates an email to us telling us to unsubscribe user-b#email.com.
Sometimes we can find the intended address if the address we sent to was very similar, or if the user has a unique name, but sometimes it's impossible to determine which email address we should unsubscribe. That's frustrating because we know the user will be upset if they receive another email from us in the future.
I tried to fix this by adding a unique identifier to the subject line, so that a subject looks like unsubscribe_20934832034820348, but when we do that, email clients stop showing the Unsubscribe button. It's as if they will only show the Unsubscribe button if the subject line is exactly "unsubscribe".
I didn't see anything in the RFC about the subject line needing to take a particular form, and we are also taking care not to put the user's email address directly in the subject line. (It is a hashed combination of their email address and a portion of the original message, making it unique across all emails we send.)
Is there some sort of convention around this? If so, how can I reliably determine the original address we sent to when we receive unsubscribe emails?
It looks like there is no problem using this sort of subject line. However, it seems that each email client decides in its own proprietary way when and how to display the Unsubscribe button/link, and it does seem that that when you change from a simple "unsubscribe" to "unsubscribe" plus some unique identifier, some clients might subject you to some sort of test period before showing the link to users. In my testing, Gmail did not show me the link when sending small batches of test emails, but after I sent a large batch of emails, the link did start appearing, and I did indeed receive the generated unsubscribe mails properly.
I hope this helps someone out there.

BCC Field in Email Implementation

Recently we are creating an application for interpreting email contents, this application shall give us the TO addresses, CC addresses and BCC addresses.
When handling BCC field, we found it seems not able to get BCC addresses directly. Referring to RFC2822, MORE QUESTIONS arise.
" There are three ways in which the "Bcc:" field is used.
In the first case, when a message containing a "Bcc:" field
is prepared to be sent, the "Bcc:" line is removed even
though all of the recipients (including those specified
in the "Bcc:" field) are sent a copy of the message...
Finally, since a "Bcc:" field may contain no addresses, a
"Bcc:" field can be sent without any addresses indicating
to the recipients that blind copies were sent to someone. "
Suppose an email is sent out as below adddresses
To: to1#address.com
cc: cc1#address.com
bcc: bcc1#address.com
My questions are, when the recipient bcc1#address.com received its email, will there a "bcc1#address.com" in the email source file? If yes, then what field it is placed? If not, then how is it possible for this email to the recipient when there is no any information about the "bcc1#address.com"??
[update]
how can the email server know whose mailbox to deliver this email to, if the email message contains no information about the BCC recipient's email address, including the header part? how a server correctly forwards such an email?
The content of an email does not necessarily contain any information about its recipients. During message transport, this information is carried in the message envelope, which is then discarded on delivery.
What you are pursuing cannot be done reliably (although many person-to-person messages obviously contain the information in the headers).
Many mailing list messages are good examples, especially those which are delivered to multiple recipients in the same domain.

How can i handle bcc information with qmail?

I use qmail, and i send a mail with Thunderbird or Outlook. I can handle to, from, body, cc informations with qmail. But i cannot handle bcc. Because people say "qmail stripts out bcc." Some other people says "it is not job of qmail ( mta) , problem is from thunderbird (mua), it strips out bcc ". I don't know which is true.
So, How can i handle bcc information with qmail , Can you explain ?
Thanks.
You have to distinguish between receivers in header and in smtp-envelope. What you use as "To", "Cc" end up as header fields in your mail and are also used as envelope receipients in SMTP. The header fields are merely informational and are not used for message delivery. For "Bcc", your MUA (e.g. Thunderbird) does not include a header field in the mail, but only uses a corresponding envelope-receipient when handing over the message to the mail server. Adding Bcc information to the mail itself actually would defeat its purpose. Therefore, no information about this receiver is contained in the message itself. So qmail does not "strip out bcc" from the mail, since was never there, but it will be able to deliver the mail anyway.

Is there a way to prevent mail clients from caching an email address?

We have an application that allows users exchange messages, and delivers the message through email. But we don't reveal sender's email, instead; every time a message is sent out a new email address gets generated for the "From" field. Something similar to the way Facebook or LinkedIn send out messages.
Everything works fine, except the recipient's email client caches all these email addresses.
For instance, if Jack sends two messages to Jill, the sender's addresses can be: a123#FakeEmail.com and a456#FakeEmail.com, so next time Jill composes a new message and starts typing Jack's name, the email client suggests two addresses for Jack.
So my question is, how we can prevent email caching on client's machine? Is there something similar to HTTP header Pragma: no-cache for SMTP?
Thanks
Nivresh
OK, here is what I ended up doing. To prevent Outlook and other mail clients from suggesting several dummy email addresses generated for the same contact name, I add a special character to the beginning of the sender's name. This can be a space or if you use Unicode, you can add a zero-width space (\u200B) to the beginning of the name.
So in my example, the email is sent from "\u200BJack" which will be shown as "Jack". The dummy email address will be saved in mail client under the name of "\u200BJack" and when the recipient later on tries to send an email to Jack, email client won't suggest this address.
Hope this helps someone.

How can I hide the 'to' field in the email sent by php mail

I am using php mail function to allow user to send me a mail from
website.
I am also allowing them to "cc" the email to themselves.
The whole purpose of making a "send us message" feature was not give our email to the users. But when the user selects the "cc" option, in the header of the mail that is sent to the user, the "to" field contains our primary email address.
How can I remove this, so that the users do not see our primary email address in the to field.
You could set the mailTo to an arbitrary mailbox at your domain "noreply#yourdomain.com" and add your company address in BCC?
But whatever reason you have for not exposing your email, imho it's quite unpolite :)
The e-mail message sent to you must have a To: field to be delivered correctly. You could emulate the CC feature by sending to separate e-mail messages to the office and to the client.