3

I am using a Canvas on which user draws. And i do have a E-Mail link beside it I want that when the E-Mail is clicked the canvas is coverted in to image and that image is to be e-mailed as a attachment.

So far i've converted the canvas in to image using

var image = canvas.toDataURL(); It gives a base64 encoded image.

On E-Mail link <a href="mailto:abc@domain.com?subject=my report&body=see attachment&attachment="image" ">E-Mail</a>

But this gives me the base64 encoded string in the body of the mail.

Is there any way out to attach the image as a attachment in mail using javascript,php,jquery or anything else??

4

1 回答 1

1

您将需要在服务器端做一些事情来完成这项工作。我的建议是这样的:

  1. 用户单击将图像数据推送到服务器的电子邮件链接/按钮。
  2. 在服务器端,图像数据被保存到一个临时文件中。
  3. 临时文件附加到电子邮件并发送给用户。
  4. 然后删除临时文件。

至于您将如何具体执行此操作...我认为大多数步骤都很直观,但是您将需要一些方法来轻松地邮寄附件。有很多解决方案,但如果你不介意一些无耻的自我推销,请查看我的 PHP 邮件脚本:

https://github.com/stlewis/Mail

它非常易于使用,并且支持所有类型的附件。

于 2013-03-11T18:26:01.300 回答