Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smtp-connection

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smtp-connection

Connect to SMTP servers

  • 4.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
121K
decreased by-14.93%
Maintainers
1
Weekly downloads
 
Created

What is smtp-connection?

The smtp-connection npm package is a low-level module for handling SMTP (Simple Mail Transfer Protocol) connections. It allows you to connect to an SMTP server, authenticate, and send emails. This package is useful for developers who need fine-grained control over the SMTP communication process.

What are smtp-connection's main functionalities?

Connecting to an SMTP Server

This feature allows you to establish a connection to an SMTP server. You can specify the host, port, and whether to use a secure connection.

const SMTPConnection = require('smtp-connection');
const connection = new SMTPConnection({
  host: 'smtp.example.com',
  port: 587,
  secure: false
});
connection.connect(function(err) {
  if (err) {
    console.error('Connection error:', err);
  } else {
    console.log('Connected to SMTP server');
  }
});

Authenticating with the SMTP Server

This feature allows you to authenticate with the SMTP server using a username and password.

connection.login({
  user: 'username',
  pass: 'password'
}, function(err) {
  if (err) {
    console.error('Authentication error:', err);
  } else {
    console.log('Authenticated successfully');
  }
});

Sending an Email

This feature allows you to send an email through the connected and authenticated SMTP server. You can specify the sender, recipient, subject, and body of the email.

const message = {
  from: 'sender@example.com',
  to: 'recipient@example.com',
  subject: 'Test Email',
  text: 'Hello, this is a test email.'
};
connection.send({
  from: message.from,
  to: message.to
}, message, function(err, info) {
  if (err) {
    console.error('Send error:', err);
  } else {
    console.log('Email sent:', info);
  }
});

Other packages similar to smtp-connection

Keywords

FAQs

Package last updated on 07 Apr 2017

Did you know?

Socket

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.

Install

Related posts

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