html - When sending an email with meteorjs, the base64 inline image is not displayed correctly -
current situation:
(client side) template:
<template name="feedback"> <h1>the image</h1> <img src="{{image}}" alt=""/> </template>
(client side) calling mail function:
var datacontext={ image: canvas.todataurl('image/png') }; var html=blaze.tohtmlwithdata(template.feedback, datacontext); meteor.call('feedback', html);
(server side):
email.send({ to: 'xxx', from: 'xxx', subject: 'xxx', html: html });
expected result: nice email embedded image.
actual result: mail partially html, partially 'raw' text. have no clue why.
this part of see in raw email:
content-type: text/html; charset=utf-8 content-transfer-encoding: quoted-printable <h1>the image</h1> =20=20=20=20<img = src=3d"data:image/png;base64,ivborw0kggoaaaansuheugaab4aaaalkcayaaadtwuxraa
any ideas?
gmail, many other clients, not allow use base64 source in img tag. there ways around though:
first , easiest might keep image on server , put url image source tag. has added benefit of being able handle tracking (some additional development required).
second use third party mail system , send them image , html , set way. might number of reasons doesn't answer question.
finally can in email template have adding multipart multitype boundary solution similar answer:
Comments
Post a Comment