简体   繁体   English

邮件正文的完整内容无法使用发送

[英]full content for mail body cannot send using <a href='mailto:{$to}?subject={$subject}&body={$body}'>

i'm in trouble with passing multiple lines through mailto: link. 我在通过mailto:链接传递多行时遇到麻烦。 in case of small content message body "mailto" link is clickable and also open window for Outlook default mail reader. 如果内容正文较小,则可以单击“ mailto”链接,并且还会打开Outlook默认邮件阅读器的窗口。 But in case of large content message body ,the mailto link couldnt clickable and also in some case full body content cannot passed to mail box, it take only limited content size. 但是,如果内容正文很大,则mailto链接将无法单击,并且在某些情况下,正文内容也无法传递到邮箱,因此仅占用有限的内容大小。 how solve this issue in PHP and Drupal. 如何在PHP和Drupal中解决此问题。 can you suggest any other method for this. 你能建议其他方法吗

my code is following:- 我的代码如下:

$to= "XXX@mail.com";
$subject = "XXX"
$body = str_replace( array( '\'', '&','amp;','<p>','</p>','nbsp'), ' ', $str_body);
$body = htmlspecialchars($body);

$page.="<div>";
$page.= "<a href='mailto:{$to}?subject={$subject}&body={$body}'>"; 
$page.="</div>";

Use urlencode() on the $subject, $body 在$ subject,$ body上使用urlencode()

$to= "XXX@mail.com";
$subject = urlencode("XXX");
$body = strip_tags($str_body); // use strip tags
$body = urlencode(htmlspecialchars($body));

The behavior of mailto link depends on the browser. mailto链接的行为取决于浏览器。 There is no way you can influence it. 您无法影响它。 Also you are at the mercy of the special configuration of the client computer : the browser passes the data in the link to the default email account of the default email software. 同样,您会受到客户端计算机特殊配置的支配:浏览器将链接中的数据传递到默认电子邮件软件的默认电子邮件帐户。 This might work or not. 这可能行不通。

If you want to have control over the email sent, your page must POST the data on the server and you have to send it using PHP either using the mail() function or a mailer library. 如果要控制发送的电子邮件,则页面必须将数据发布到服务器上,并且必须使用PHP(使用mail()函数或邮件程序库)发送数据。

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

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