私はちょうど./blabla.htmlと入力して直接HTMLファイルを送信し、キャンペーンやテンプレートは作成しません。埋め込みコードを入れずにメールを送信する方法はありますか?もしそうなら、私はとても幸せになるでしょう、ありがとう!あなたのsendgrid
パッケージを更新する必要があるかもしれませんSendgridが埋め込みコードなしでhtml電子メールを送信
var helper = require('sendgrid').mail
from_email = new helper.Email("[email protected]")
to_email = new helper.Email("[email protected]")
subject = "Merhaba !"
content = new helper.Content("text/plain", "selam")
mail = new helper.Mail(from_email, subject, to_email, content)
}
var sg = require('sendgrid').SendGrid("mysecretapikey")
var requestBody = mail.toJSON()
var request = sg.emptyRequest()
request.method = 'POST'
request.path = '/v3/mail/send'
request.body = requestBody
sg.API(request, function (response) {
console.log(response.statusCode)
console.log(response.body)
console.log(response.headers)
})
をこのように:http://stackoverflow.com/questions/18386361/read-a-file-in-node-js?また、HTMLとして送信する場合は、 'content'に' text/html'が必要です。 –
それは大丈夫ですが、私はその読み込み操作をどこに置くのか見つけることができません。読んだfuncを呼び出すと、cmdの内容が読み込まれ、受信者に関数名を記述したメールが送信されます。どんな助け? @ Sebastian-LaurenţiuPlesciuc – MeganLondon