2017-01-12 23 views
2

ループバック電子メールデータソースを使用して添付ファイルを送信することはできますか?ループバック電子メールデータソースを添付した電子メールを送信

私はソースのドキュメントで見ることができるすべては、これらのフィールドは、以下のとおりです。宛先を電子メールに

  • @property {文字列}。必須。
  • @property {String} from Email送信者アドレス。必須。
  • @property {String} subject電子メールの件名。必須。
  • @property {String} text電子メールのテキスト本文。
  • @property {String} html電子メールのHTML本文。 docsから
+0

私はそれがこの文脈では重複しませんように、この質問は、開いたままにするべきだと考え、それはです著者が何を求めているのかを明確にし、それはトピックであり、あまりにも広範でも意見にも基づいていない。 –

+0

人は自動的に質問を自動的にマークします。それはばかげている – dagda1

答えて

4

Nodemailer:どこドキュメントに

を探すために、電子メールコネクタは、基本的に nodemailerライブラリへのループバック統合インタフェースです。 このページには使用例があります。 設定オプションの詳細については、nodemailer documentionを参照してください。

Here's where nodemailer have documented attachments.

ここでループバックのコンテキストでの添付ファイルの異なるタイプの例です:

app.models.Email.send({ 
    to: '[email protected]', 
    from: '[email protected]', 
    subject: 'Email Subject', 
    html: '<b>Hello</b>', 
    attachments: [ 
    { // utf-8 string as an attachment 
     filename: 'text1.txt', 
     content: 'hello world!' 
    }, 
    { // binary buffer as an attachment 
     filename: 'text2.txt', 
     content: new Buffer('hello world!','utf-8') 
    }, 
    { // file on disk as an attachment 
     filename: 'text3.txt', 
     path: '/path/to/file.txt' // stream this file 
    }, 
    { // filename and content type is derived from path 
     path: '/path/to/file.txt' 
    }, 
    { // stream as an attachment 
     filename: 'text4.txt', 
     content: fs.createReadStream('file.txt') 
    }, 
    { // define custom content type for the attachment 
     filename: 'text.bin', 
     content: 'hello world!', 
     contentType: 'text/plain' 
    }, 
    { // use URL as an attachment 
     filename: 'license.txt', 
     path: 'https://raw.github.com/nodemailer/nodemailer/master/LICENSE' 
    }, 
    { // encoded string as an attachment 
     filename: 'text1.txt', 
     content: 'aGVsbG8gd29ybGQh', 
     encoding: 'base64' 
    }, 
    { // data uri as an attachment 
     path: 'data:text/plain;base64,aGVsbG8gd29ybGQ=' 
    }, 
    { 
     // use pregenerated MIME node 
     raw: 'Content-Type: text/plain\r\n' + 
     'Content-Disposition: attachment;\r\n' + 
     '\r\n' + 
     'Hello world!' 
    } 
    ], 
}, err => { 
    if (err) { 
    throw err; 
    } 
}); 
関連する問題