how to make use of nodejs single thread to read files and attach data
var mailer = require('nodemailer');
mailer.SMTP = {
host: 'host.com',
port:587,
use_authentication: true,
user: '[email protected]',
pass: 'xxxxxx'
};
Then read a file and send an email :
fs.readFile("./attachment.txt", function (err, data) {
mailer.send_mail({
sender: '[email protected]',
to: '[email protected]',
subject: 'Attachment!',
body: 'mail content...',
attachments: [{'filename': 'attachment.txt', 'content': data}]
}), function(err, success) {
if (err) {
// Handle error
}
}
});
Also in JavaScript:
- object values javascript
- change items loop react
- nested arrays reactjs tables
- mongodb find like
- command reboot android app react native adb command
- javascript how to get every element after the 1st in an array
- javascript pop object from array
- objects javascript
- how to put firebase config in a sperate file react native
- react chrome extension
- how to set background colour i js inline stylel
- js detect mouse support
- material-ui icon compass
- detect if two line segments intersect each other javascript
- textinput onpress react native
- random array javascript
- all math methos js
- active-class router-link
- how to send a message discord.js
- angular 8 how to iterate json object in view
- button not clicking for random jokes in javascript
- javascript todataurl
- spread operator javascript
- get current date javascript full month