Attach File Through mailto URI

感情迁移 提交于 2019-11-26 11:38:09

问题


Is it possible to attach a file using \"mailto:\" redirect in javascript?

Something like this:

document.location = \"mailto:\"+recipient+\"?subject=\"+subject+\"&body=\"+msg+\"?attach=\"+\"file1.zip\";

回答1:


No, you can not add an attachment to a message with the mailto: URL scheme.

mailto: only supports header values or text/plain content. See RFC 2368 for details.




回答2:


You can create a custom email form, letting the user input a valid email-address if necessary and send this to the server. The server then can use a mail library to send an email including an attachment.

If you use PHP, you can easily do this using PHPMailer.



来源:https://stackoverflow.com/questions/2372036/attach-file-through-mailto-uri

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