Inline content example
Here’s an example of sending canvas image as attachment.
1 2 3 4 5 6 |
function sendCanvasAsAttachment(canvas) { var base64 = canvas.toDataURL(); emailjs.send("<YOUR SERVICE ID>", "<YOUR TEMPLATE ID>", { content: base64 }); } |
To run this example create a template with an attachment of type “ “.
Note that the content should be passed in base64 format or URL. In the example above the toDataURL() method returns data encoded already to base64. To encode arbitrary content to base64 use btoa() method.