Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
EasyMT gives you a simple way to store and use email templates. Using ejs templates and some metadata, you can have email templates up and working in a matter of minutes. There are only a few steps to follow to get up and running.
npm install easymt
You can store the templates anywhere you like, relative to the root of your app. By default, templates is used as the directory.
Each template needs two files, a metadata file and a tempalate file. Wherever you put them, they need to be stored in the same folder.
The metadata file is a JSON file and contains some needed metadata for your template. This is also where your define what template file will be used. An example template file might look something like this:
//mytemplate.json
{
"subject": "This is an email!",
"template": "mytemplate"
}
Currently, there are only two options. subject - The subject for the email. template - The name of the template file, minus the extension.
This is the actual EJS file. It follows all the rules for EJS templates, and should use the extension .ejs.
<!--mytemplate.ejs-->
<html>
<body>
<h1><%=heading%></h1>
</body>
</html>
All you need to do now is include EasyMT and use it to get your template.
name - the name of the template, IE the filename of the template's metadata file. data - the data to pass to the template callback(err, template)
EasyMT will search for the metadata file then load in the template subject and body based on that metadata. Errors will be returned if the metadata or template file are not found.
var easymt = require('easymt');
easymt.get('mytemplate', {heading:'HELLO WORLD'}, function(err, template) {
//use template
});
Each template object returned has the following properties available. subject - The subject loaded from the metadata body - The rendered body of the template.
templateDir - Directory (relative to the application root) that the template files are stored in. options - The EJS options to pass when rendering the template.
Using the init
function is optional, but allows you to setup a few things you may want to be customized. Calling it during the require
call is the easiest way to set things up.
var easymt = require('easymt').init('path/to/templates', {open:'{{',close:'}}'});
FAQs
Simple email templates.
We found that easymt 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.