0
nodejsを使用して簡単なメール送信機能を作成しています。電子メールはモジュール速達メーラー経由で複数の受信者に電子メールを送信する
以下は私app.js
var express = require('express');
var app = express();
var mailer = require('express-mailer');
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
mailer.extend(app, {
from: '[email protected]',
host: 'smtp.gmail.com',
secureConnection: true,
port: 465,
transportMethod: 'SMTP',
auth: {
user: '[email protected]',
pass: 'mygmailpass'
}
});
app.mailer.send('email', {
to: '[email protected],[email protected],[email protected]',
subject: 'Password reset', // REQUIRED.
body: 'Your Password is set to xxxxx. Please log in back.,',
otherProperty: 'Other Property'
}, function(err) {
if (err) {
console.log(err);
return;
}
console.log('mail sent');
});
の部分であり、これは私の電子メールテンプレート、email.jade
doctype html
html
head
meta(http-equiv = 'Content-Type', content = 'text/html; charset=UTF-8')
title= subject
body
p
=body
ある
急行、メーラーによって処理されます 上記のアプリがうまくいけば、メールは受信者に送信されます。問題は、複数の受信者が存在する場合、これは、個々の受信者が電子メールを受信する方法の画像です:上記の画像上の
の通知受信者が電子メールを受信したとき、彼らはすべて見ることができますか同じメールを受け取った他の受信者。この現象の原因は何ですか?それはどのように回避できますか?現在お使いの場合には
優れた以下のようにコードを更新します。ありがとうございました! 'bcc'オプションのために行ったが、アプリケーションの要求が変わったときにループを使うように切り替える – suo