嘗試在Node.js中的Bluemix編碼中使用SendGrid服務。我使用addCc()方法向cc添加地址。我沒有收到錯誤消息,郵件已發送到主地址,但沒有任何內容發送到cc:ed地址。如果我看到主要收件人的郵件頂部,我可以在那裏看到cc地址。有沒有人知道在使用cc與SendGrid時是否存在錯誤或限制?使用Bluemix中的SendGrid服務進行綁定
此致
W¯¯
嘗試在Node.js中的Bluemix編碼中使用SendGrid服務。我使用addCc()方法向cc添加地址。我沒有收到錯誤消息,郵件已發送到主地址,但沒有任何內容發送到cc:ed地址。如果我看到主要收件人的郵件頂部,我可以在那裏看到cc地址。有沒有人知道在使用cc與SendGrid時是否存在錯誤或限制?使用Bluemix中的SendGrid服務進行綁定
此致
W¯¯
一個常見的錯誤是當它需要一個字符串傳遞一個陣列到addCc()函數。使用'sendgrid'npm模塊的v2.0.0,下面的代碼將正確地發送一個cc的'[email protected]'的電子郵件。
正如評論上面提到的,確認沒有用完的問題https://github.com/sendgrid/sendgrid-nodejs/issues/162
// Pre-req: get the SendGrid credentials for username and password
// from VCAP_SERVICES into the 'user' and 'pass' vars
var sendgrid = require('sendgrid')(user, pass);
var email = new sendgrid.Email({
to: '[email protected]',
from: '[email protected]',
subject: 'SendGrid Test',
text: 'This is a SendGrid test'
};
// add a cc address as a single string
email.addCc('[email protected]');
sendgrid.send(email, function(err, json) {
if (err) {
return console.error(err);
}
console.log(json);
}
我用過1.9.2。我通過直接更新變量(例如mail.cc = ccAdress)而不是使用方法來解決我的問題。 thnx每個人的提示和技巧。非常感謝W –
我假設你正在使用的「sendgrid」 NPM模塊。什麼版本?難道是你打了https://github.com/sendgrid/sendgrid-nodejs/issues/162?看起來應該在最近的版本中修復它。 – jimmc