简体   繁体   English

PHP邮件仅通过SMTP发送到BCC接收者

[英]PHP Mail Sending via SMTP only to BCC receivers

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. 我正在用php写一个邮件列表,并且需要一种在本地通过smtp(Postfix)发送邮件时强制发送邮件的方法,实际上只是将该邮件发送给BCC接收者。

(Having To and Cc headers sending them in the mail, but not sending the mail TO them) (具有To和Cc标头在邮件中发送它们,但不向它们发送邮件)

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) 在php脚本中,我编辑邮件(删除禁止的单词,添加带有签出链接的页脚等),并且希望比通过smtp发送邮件(mail()不好,它没有错误处理)

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) 还是可以留在后缀队列中(邮件通过管道传递到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. 我发送的邮件涉及以下内容:mailing.list-adress(因为必须显示邮件已发送到邮件列表)和所有其他Tos,但脚本不应将其发送至该地址应该发送给密件抄送地址。

The Mail-Flow is 邮件流为

Sender => specific-list@server.de => lists@server.de => php-programm => drop 发件人=>特定列表@ server.de =>列表@ server.de => php程序=>删除

Every 5 Minutes (Or other time the user specified) the List will be rolled out: 每5分钟(或用户指定的其他时间),该列表就会推出:

mail in database => script => receipients as bcc, to is list-adress (specific-list@server.de) 数据库中的邮件=>脚本=>收件人为密件抄送,到列表地址(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. 我有一个解决方案,但是需要帮助。

  1. I create a internal mail-address, that forwards to my real receipients 我创建了一个内部邮件地址,该地址会转发给我的真实收件人
  2. I send the mail to that address 我将邮件发送到该地址
  3. Postfix has to handle that mail not as an outgoing mail but as a new mail delivered to that adress. Postfix必须处理该邮件,而不是将其作为外发邮件,而是作为发送给该地址的新邮件。
  4. 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. 有了收件人后,就可以继续创建密件抄送。

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

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