gpt4 book ai didi

loopbackjs - 使用回送电子邮件数据源发送带有附件的电子邮件

转载 作者:行者123 更新时间:2023-12-04 23:16:10 26 4
gpt4 key购买 nike

是否可以使用回送电子邮件数据源发送附件?

我在源文档中只能看到这些字段:

  • @property {String} 到电子邮件收件人。必需的。
  • @property {String} 来自电子邮件发件人地址。必需的。
  • @property {String} subject 电子邮件主题字符串。必需的。
  • @property {String} text 电子邮件的文本正文。
  • @property {String} 电子邮件的 HTML HTML 正文。
  • 最佳答案

    来自 docs :

    Nodemailer: Where to Find Documentation

    The email connector is essentially a LoopBack-integrated interface to the nodemailer library. This page gives a usage example; for full documentation of configuration options, refer to the nodemailer documention.



    Here's where nodemailer have documented attachments.

    以下是环回上下文中不同类型附件的示例:
    app.models.Email.send({
    to: 'example@example.com',
    from: 'no-reply@example.com',
    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;
    }
    });

    关于loopbackjs - 使用回送电子邮件数据源发送带有附件的电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41624549/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com