Loopback send Email with attachment from another module

断了今生、忘了曾经 提交于 2020-01-06 05:56:13

问题


I have form where i can able to save the file in some location and can store the values in the database.Now i have the email connector where i can fetch the values of the form and send it through email. I have two models one is for storing the values in the database i.e PersistedModel and the other is for storing the attachment now i want to send an email with attachment. how to send can anyone help me.

career.js

'use strict';
const app = require('../../server/server');
module.exports = function(Career) {
    Career.afterRemote('create', function(context, remoteMethodOutput, next) { 
        next(); 

Contact.app.models.Email.send({ 
    to: 'lakshmipriya.l@company.com', 
    from: 'lakshmipriya.l@gmail.com', 
    subject: 'my subject', 
    text: 'my text', 
    html: 'my <em>html</em>',
 attachments: [
    {  
      path: /path/to/remoteMethodOutput.resume
    }
],
    }, function(err, mail) { 
    console.log('email sent!'); 
    cb(err); 
    }); 
    }); 

};

I tried this but its not working because the resume is in another attachment module. so i could not fetch the resume. how to fetch and attach the file.

来源:https://stackoverflow.com/questions/55451895/loopback-send-email-with-attachment-from-another-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!