New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mailersend

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailersend - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

3

lib/models/email/Attachment.d.ts

@@ -5,3 +5,4 @@ export declare class Attachment {

disposition: string;
constructor(content: string, fileName: string, disposition?: string);
id?: string;
constructor(content: string, fileName: string, disposition?: string, id?: string);
}

@@ -5,3 +5,3 @@ "use strict";

var Attachment = /** @class */ (function () {
function Attachment(content, fileName, disposition) {
function Attachment(content, fileName, disposition, id) {
if (disposition === void 0) { disposition = "attachment"; }

@@ -11,2 +11,3 @@ this.content = content;

this.disposition = disposition;
this.id = id;
}

@@ -13,0 +14,0 @@ return Attachment;

{
"name": "mailersend",
"version": "2.0.4",
"version": "2.0.5",
"description": "Node.js helper module for MailerSend API",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -22,3 +22,3 @@ <a href="https://www.mailersend.com"><img src="https://www.mailersend.com/images/logo.svg" width="200px"/></a>

- [Send an email](#send-an-email)
- [Add CC, BCC recipients](#add-cc--bcc-recipients)
- [Add CC, BCC recipients](#add-cc-bcc-recipients)
- [Send a template-based email](#send-a-template-based-email)

@@ -28,2 +28,3 @@ - [Advanced personalization](#advanced-personalization)

- [Send email with attachment](#send-email-with-attachment)
- [Send email with inline attachment](#send-email-with-inline-attachment)
- [Send bulk emails](#send-bulk-emails)

@@ -309,2 +310,41 @@ - [Get bulk request status](#get-bulk-request-status)

### Send email with inline attachment
```js
import 'dotenv/config';
import fs from "fs";
import { MailerSend, EmailParams, Sender, Recipient, Attachment } from "mailersend";
const mailerSend = new MailerSend({
apiKey: process.env.API_KEY,
});
const sentFrom = new Sender("you@yourdomain.com", "Your name");
const recipients = [
new Recipient("your@client.com", "Your Client")
];
const attachments = [
new Attachment(
fs.readFileSync('/path/to/file.png', { encoding: 'base64' }),
'file.png',
'inline',
'0123456789'
)
]
const emailParams = new EmailParams()
.setFrom(sentFrom)
.setTo(recipients)
.setReplyTo(sentFrom)
.setAttachments(attachments)
.setSubject("This is a Subject")
.setHtml("<strong>This is the HTML content with an inline image attachment <img src=\"cid:0123456789\"/></strong>")
.setText("This is the text content");
await mailerSend.email.send(emailParams);
```
### Send a scheduled email

@@ -311,0 +351,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc