问题
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