traker
traker

Reputation: 101

open imap fetch body as outlook mail

I have a button in my php page which has

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

i want to open outlook with the body

$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.";

and my button

<a href="mailto:[email protected]?subject=<?php echo $details['subject']?>&body=<?php echo $details['body'] ?>"><i class="fa fa-eye"></i></a>

button get broken.please help me.how to solve this issue.any help would be appreciated.

Upvotes: 1

Views: 187

Answers (1)

Syscall
Syscall

Reputation: 19780

You have to encode the strings using rawurlencode(), to be used in URI, according to RFC 3986 - Uniform Resource Identifier.

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

This will outputs :

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

Upvotes: 2

Related Questions