简体   繁体   English

PHPMailer或php邮件功能-显示密件抄送地址

[英]PHPMailer or php mail function - show BCC address

I'm using PHPMailer to send mails to a clients database when certain events triggers. 当某些事件触发时,我正在使用PHPMailer将邮件发送到客户端数据库。 Obviously I don't want everyone to get the full list of client's emails, so i'm sending those in BCC using PHPMailer. 显然,我不希望每个人都获得客户端电子邮件的完整列表,因此我要使用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. PHP本机mail()函数也是如此。

Is there a way to handle this ? 有办法解决吗?

Thanks ahead ! 提前谢谢!

No, that's not how BCC works. 不,那不是BCC的工作方式。

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. 它与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'. 如果您希望收件人在“收件人”字段中看到某些内容,则需要在其中填充一个虚拟值,例如“ donotreply@yourdomain.com”。

It is good to send messages like this via BCC, so you're doing the right thing. 最好通过BCC发送这样的消息,所以您做对了。 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. 在第一种情况下,当准备发送包含“ BCC:”字段的消息时,即使发送了所有收件人(包括在“ BCC:”字段中指定的收件人),也会删除“ BCC:”行。消息的副本。

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. 最后,由于“密件抄送:”字段可以不包含任何地址,因此可以发送“密件抄送:”字段而没有任何地址向接收者指示将密件发送给某人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM