mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge branch 'pr/963' into devel
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
|
||||
* Upgrade CoffeeScript from 1.5.0 to 1.6.2. #972
|
||||
|
||||
* `Email.send` has a new `headers` option to set arbitrary headers. #963
|
||||
|
||||
* The `localstorage-polyfill` smart package has been replaced by a
|
||||
`localstorage` package, which defines a `Meteor._localStorage` API instead of
|
||||
trying to replace the DOM `window.localStorage` facility. (Now, apps can use
|
||||
@@ -22,7 +24,7 @@
|
||||
|
||||
* Support `appcache` on Chromium. #958
|
||||
|
||||
Patches contributed by GitHub user awwx.
|
||||
Patches contributed by GitHub users awwx and spang.
|
||||
|
||||
## v0.6.2.1
|
||||
|
||||
|
||||
@@ -1804,6 +1804,10 @@ Template.api.email_send = {
|
||||
{name: "html",
|
||||
type: "String",
|
||||
descr: rfc('mail body (HTML)')
|
||||
},
|
||||
{name: "headers",
|
||||
type: "Object",
|
||||
descr: rfc('custom headers (dictionary)')
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -85,12 +85,12 @@ var smtpSend = function (mc) {
|
||||
* @param options.subject {String} RFC5322 "Subject:" line
|
||||
* @param options.text {String} RFC5322 mail body (plain text)
|
||||
* @param options.html {String} RFC5322 mail body (HTML)
|
||||
* @param options.headers {Object} custom RFC5322 headers (dictionary)
|
||||
*/
|
||||
Email.send = function (options) {
|
||||
var mc = new MailComposer();
|
||||
|
||||
// setup message data
|
||||
// XXX support arbitrary headers
|
||||
// XXX support attachments (once we have a client/server-compatible binary
|
||||
// Buffer class)
|
||||
mc.setMessageOption({
|
||||
@@ -104,6 +104,10 @@ Email.send = function (options) {
|
||||
html: options.html
|
||||
});
|
||||
|
||||
_.each(options.headers, function (value, name) {
|
||||
mc.addHeader(name, value);
|
||||
});
|
||||
|
||||
maybeMakePool();
|
||||
|
||||
if (smtpPool) {
|
||||
|
||||
@@ -14,7 +14,8 @@ Tinytest.add("email - dev mode smoke test", function (test) {
|
||||
to: "bar@example.com",
|
||||
cc: ["friends@example.com", "enemies@example.com"],
|
||||
subject: "This is the subject",
|
||||
text: "This is the body\nof the message\nFrom us."
|
||||
text: "This is the body\nof the message\nFrom us.",
|
||||
headers: {'X-Meteor-Test': 'a custom header'}
|
||||
});
|
||||
// Note that we use the local "stream" here rather than Email._output_stream
|
||||
// in case a concurrent test run mutates Email._output_stream too.
|
||||
@@ -22,6 +23,7 @@ Tinytest.add("email - dev mode smoke test", function (test) {
|
||||
test.equal(stream.getContentsAsString("utf8"),
|
||||
"====== BEGIN MAIL #0 ======\n" +
|
||||
"MIME-Version: 1.0\r\n" +
|
||||
"X-Meteor-Test: a custom header\r\n" +
|
||||
"From: foo@example.com\r\n" +
|
||||
"To: bar@example.com\r\n" +
|
||||
"Cc: friends@example.com, enemies@example.com\r\n" +
|
||||
|
||||
Reference in New Issue
Block a user