简体   繁体   English

PHPMailer:从电子邮件地址隐藏正文

[英]PHPMailer: Hide body text from email address

I was wondering if it was possible to hide certain parts of the body message in PHPMailer depending on the email address. 我想知道是否有可能根据电子邮件地址在PHPMailer中隐藏正文消息的某些部分。 I have 2 email addresses that are being sent the message, and the second email address needs to only see parts of what the first email address is seeing. 我有2个正在发送邮件的电子邮件地址,第二个电子邮件地址只需要看到第一个电子邮件地址的部分内容。 Is there a way to identify that I only want the first email address to see the content. 有没有办法确定我只希望第一个电子邮件地址可以看到内容。 For example: 例如:

$mail = new PHPMailer();
$mail->AddReplyTo($fromemail, "".$fromname."");
$mail->AddReplyTo("emailaddress1@abc.com", "Company ABC");
$mail->SetFrom($fromemail, "".$fromname."");
$mail->AddAddress("emailaddress1@abc.com", "Company ABC");//would see the whole email
$mail->AddAddress("partneraddress@somecompany.com", "Partner Company");//would only see 1st paragraph
$subject = "Email Subject";
$mail->AltBody = "To view this message, please use an HTML compatible email viewer";
$mail_body .= "
<html>
  <head>
   <title>Email Message</title>
  </head>
  <body>
    <p>This would be a paragraph that both email addresses see</p>";
if ($mail->AddAddress == "emailaddress1@abc.com") {
$mail_body .= "<p>This would only be seen by the first address</p>";
   } 
$mail_body .= "</body>
</html>";

This will not be possible without sending two different messages to the recipients, having different body content. 如果不将两个不同的邮件发送给具有不同正文内容的收件人,这将是不可能的。 Although some mail clients out there might still support and execute Javascript without user intervention (I doubt it though), it could not be relied on at all. 尽管那里的一些邮件客户端在没有用户干预的情况下仍然可以支持和执行Javascript(尽管我对此表示怀疑),但是完全不能依赖它。

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

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