Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
loopback-connector-mailgun
Advanced tools
Loopback connector module which allow to send emails via Mailgun
Loopback connector module which allow to send emails via Mailgun.
npm install loopback-connector-mailgun --save
datasources.json
{
"mailgun": {
"connector": "loopback-connector-mailgun",
"apikey": "[your api key here]",
"domain": "[your domain here]"
}
}
model-config.json
{
"Email": {
"dataSource": "mailgun",
"public": false
}
}
Additionaly you can set defaults
{
"mailgun": {
"connector": "loopback-connector-mailgun",
"apikey": "[your api key here]",
"defaults": {
"someSettings": "SomeSettingsValues"
}
}
}
Basic option same as built in Loopback. Returns a Promise
loopback.Email.send({
to: "to@to.com",
from: "fron@from.com",
subject: "subject",
text: "text message",
html: "html <b>message</b>",
attachments : [path.resolve('../client/images/an-image.jpg')],
var : {
myVar1 : 'a custom value'
},
headers : {
"X-My-Header" : "My Custom header"
}
})
.then(function(response){})
.catch(function(err){});
###Example of attaching a file stream In this case we will pass a file stream as an attachment. Note the structure of the attachment object, every property is required by mailgun in order to send the attachment. Omitting properties will cause mailgun to drop your attachment, the message will be delivered though
var path = require('path');
var mime = require('mime');
var file = path.resolve('../client/images/an-image.jpg');
var fileStream = fs.createReadStream(file);
var fileStat = fs.statSync(file);
var attachment = {
data: fileStream,
filename: path.basename(file),
knownLength: fileStat.size,
contentType: mime.lookup(file)//REQUIRED, by omitting this, mailgun will not send your attachment
};
loopback.Email.send({
to: "to@to.com",
from: "from@from.com",
subject: "subject",
text: "text message",
html: "html <b>message</b>",
attachments : [attachment]
})
.then(function(response){})
.catch(function(err){});
###quick note on attachments Refer to Mailgun documentation on limitations concerning attachments. The attachments property can be either an array of strings or buffers or a string.
FAQs
Loopback connector module which allow to send emails via Mailgun
The npm package loopback-connector-mailgun receives a total of 56 weekly downloads. As such, loopback-connector-mailgun popularity was classified as not popular.
We found that loopback-connector-mailgun demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.