打开imap获取正文作为Outlook邮件

时间:2018-03-10 14:29:13

标签: php email outlook

我的php页面中有一个按钮

$body = imap_fetchbody($mbox, $num, 2);

我想用身体打开前景

$body="

From: test
Sent: Wednesday, March 7, 2018 10:25 PM
To: test2
Subject: Report Clarity/Option



name,



I need the following tweaks/fixes in the report



test1
test2
test3


Thanks and Regards


name
Adress





E-MAIL CONFIDENTIALITY NOTICE: The contents of this e-mail message and any attachments are intended solely for the addressee(s) and may contain confidential and/or legally privileged information. If you are not the intended recipient of this message or if this message has been addressed to you in error, please immediately alert the sender by reply e-mail and then delete this message and any attachments. If you are not the intended recipient, you are notified that any use, dissemination, distribution, copying, or storage of this message or any attachment is strictly prohibited.";

和我的按钮

<a href="mailto:name@off.com?subject=<?php echo $details['subject']?>&body=<?php echo $details['body'] ?>"><i class="fa fa-eye"></i></a>

按钮被破坏。请帮助我。如何解决这个问题。非常感谢。

1 个答案:

答案 0 :(得分:2)

根据rawurlencode(),您必须使用RFC 3986 - Uniform Resource Identifier对字符串进行编码,以便在URI中使用。

<a href="mailto:name@off.com?subject=<?php echo rawurlencode($details['subject'])?>&body=<?php echo rawurlencode($details['body']) ?>"><i class="fa fa-eye"></i></a>

这将输出:

<a href="mailto:name@off.com?subject=...&body=%0A%0AFrom%3A%20test%0ASent%3A%20Wednesday%2C%20March%207%2C%202018%2010%3...."><i class="fa fa-eye"></i></a>