mailto:无法添加附件 [英] mailto: unable to add attachments

查看:445
本文介绍了mailto:无法添加附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML链接.当用户单击链接时,我正在使用mailto打开邮件. 我可以将设置为电子邮件ID和主题,但无法添加附件.

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.

此特定表单现在位于localhost中,但稍后将移至实时服务器.这些附件文件存储在一个文件夹中,我从PHP变量获取这些文件的路径.

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.

我如何做到这一点?

这是示例代码.

$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>

推荐答案

您不能. mailto: URI方案不支持附件(而且,客户端通常无论如何都无法访问Web服务器的硬盘).

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).

考虑从您的PHP而不是访问者的电子邮件客户端发送电子邮件.

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

这篇关于mailto:无法添加附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆