mailto: unable to add attachments

寵の児 提交于 2020-01-07 05:48:20

问题


I have an HTML link. I'm using mailto to open up the mail when a user clicks on the link. I'm able to set the to email id and subject but I'm not able to add an attachment.

This particular form is now in localhost but it will be moved to live server later. These attachment files are stored in a folder and I get the path to these files from a PHP variable.

I tried passing the path to it but it didn't add the attachment.

How can I make this happen?

Here's the sample code.

$filePath = 'C:\xampp\htdocs\sampleProject\attachments\pdfs\samplepdf-03.pdf'

<a href="mailto:?subject=Pictures from PhotoAlbum
         &body=This is the body text
         &attachment='<?php echo $filePath; ?>'">
Email This
</a>

回答1:


You can't. The mailto: URI scheme doesn't support attachments (and the client wouldn't usually have access to the web server's hard disk anyway).

Consider sending the email from your PHP instead of from your visitor's email client.



来源:https://stackoverflow.com/questions/44412827/mailto-unable-to-add-attachments

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!