Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Loopbackjs 使用环回电子邮件数据源发送带有附件的电子邮件_Loopbackjs_Nodemailer - Fatal编程技术网

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

Loopbackjs 使用环回电子邮件数据源发送带有附件的电子邮件,loopbackjs,nodemailer,Loopbackjs,Nodemailer,是否可以使用回送电子邮件数据源发送附件 我在源文档中只能看到以下字段: @属性{String}发送给电子邮件收件人。必需的 @来自电子邮件发件人地址的属性{String}。必需的 @属性{String}主题电子邮件主题字符串。必需的 @属性{String}电子邮件的文本正文 @属性{String}电子邮件的html正文 来自: nodeEmailer:在哪里可以找到文档 电子邮件连接器是 本质上是一个到库的环回集成接口。 本页给出了一个使用示例;有关 配置选项,请参阅 以下是环回上下文中不同

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

我在源文档中只能看到以下字段:

  • @属性{String}发送给电子邮件收件人。必需的
  • @来自电子邮件发件人地址的属性{String}。必需的
  • @属性{String}主题电子邮件主题字符串。必需的
  • @属性{String}电子邮件的文本正文
  • @属性{String}电子邮件的html正文
来自:

nodeEmailer:在哪里可以找到文档

电子邮件连接器是 本质上是一个到库的环回集成接口。 本页给出了一个使用示例;有关 配置选项,请参阅

以下是环回上下文中不同类型附件的示例:

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;
  }
});
app.models.Email.send({
致:'example@example.com',
发信人:“没有-reply@example.com',
主题:'电子邮件主题',
html:'你好',
附件:[
{//utf-8字符串作为附件
文件名:“text1.txt”,
内容:“你好,世界!”
},
{//作为附件的二进制缓冲区
文件名:“text2.txt”,
内容:新缓冲区('hello world!','utf-8')
},
{//磁盘上的文件作为附件
文件名:“text3.txt”,
路径:'/path/to/file.txt'//流式传输此文件
},
{//文件名和内容类型是从路径派生的
路径:'/path/to/file.txt'
},
{//流作为附件
文件名:“text4.txt”,
内容:fs.createReadStream('file.txt')
},
{//为附件定义自定义内容类型
文件名:“text.bin”,
内容:“你好,世界!”,
contentType:“文本/普通”
},
{//将URL用作附件
文件名:“license.txt”,
路径:'https://raw.github.com/nodemailer/nodemailer/master/LICENSE'
},
{//作为附件的编码字符串
文件名:“text1.txt”,
内容:“aGVsbG8gd29ybGQh”,
编码:“base64”
},
{//数据uri作为附件
路径:“数据:text/plain;base64,aGVsbG8gd29ybGQ=”
},
{
//使用预生成的MIME节点
原始:“内容类型:文本/普通\r\n”+
'内容处置:附件;\r\n'+
“\r\n”+
“你好,世界!”
}
],
},err=>{
如果(错误){
犯错误;
}
});

我认为这个问题应该留待讨论,因为在这种情况下,它不是重复的,它清楚作者在问什么,它是关于主题的,不太宽泛,也不太基于观点。人们现在会自动记下问题。这真是太可笑了有没有邮件发送的完整示例代码,因为即使我在表单提交后也试图发送电子邮件。我是否需要单独安装nodemailer以通过loopback发送电子邮件我相信它是通过loopback安装的,作为其电子邮件连接器的一部分。我也试图发送带有附件的电子邮件,但它不起作用,数据是一个模块,附件在另一个模块中,我正在尝试合并并通过电子邮件发送它。