简体   繁体   English

使用javascript在邮件正文中发送图像

[英]send image in mail body using javascript

I want to embed an image in the mail body using javascript and jquery: 我想使用javascript和jquery在邮件正文中嵌入一个图像:

function SendEmail(StudyMail) {
     var emailBodyContent = "<span> " + greating + "</span> ,\n\n";
     emailBodyContent += " <img src=\"images/1.png\" />";
      DivMailBody.html(emailBodyContent);

        var body = DivMailBody.text();

        var contents = "".concat('mailto:' + StudyMail, '?subject= A new study', '&body=', encodeURIComponent(body));

        var pwin = window.open(contents, "_blank", "toolbar=yes, scrollbars=no, resizable=no, width=100, height=100");
        try {
            setTimeout(function () {
                pwin.close();
            }, 100);
        } catch (e) {
        }
}

it sends the mail without the image. 它发送没有图像的邮件。

You must you image tag like below and emmbed your image inside your html page 你必须像下面的图像标记,并在你的HTML页面内嵌入你的图像

<img src=\"cid:filename\">

for embedding image you can use the following linke 对于嵌入图像,您可以使用以下链接

embedding image in html email 在html电子邮件中嵌入图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM