mailto body html,email - mailto link with HTML body - Stack Overflow

本文介绍了一种使用现代JavaScript技术在客户端创建EML文件的方法,并演示了如何将该文件流式传输到用户的文件系统中,以便用邮件客户端如Outlook打开包含HTML内容的富文本邮件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

It's not quite what you want, but it's possible using modern javascript to create an EML file on the client and stream that to the user's file system, which should open a rich email containing HTML in their mail program, such as Outlook:

Here's a jsfiddle of an email containing images and tables: https://jsfiddle.net/seanodotcom/yd1n8Lfh/

HTML

To: User

Subject: Subject

X-Unsent: 1

Content-Type: text/html

body, html, table {

font-family: Calibri, Arial, sans-serif;

}

.pastdue { color: crimson; }

table {

border: 1px solid silver;

padding: 6px;

}

thead {

text-align: center;

font-size: 1.2em;

color: navy;

background-color: silver;

font-weight: bold;

}

tbody td {

text-align: center;

}

PAST DUE INVOICE

Invoice #Days OverdueAmount Owed

OU8129$4395.00OU8129$4395.00OU8129$4395.00

Create file

Download

Javascript

(function () {

var textFile = null,

makeTextFile = function (text) {

var data = new Blob([text], {type: 'text/plain'});

if (textFile !== null) {

window.URL.revokeObjectURL(textFile);

}

textFile = window.URL.createObjectURL(data);

return textFile;

};

var create = document.getElementById('create'),

textbox = document.getElementById('textbox');

create.addEventListener('click', function () {

var link = document.getElementById('downloadlink');

link.href = makeTextFile(textbox.value);

link.style.display = 'block';

}, false);

})();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值