npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aws-receive-email

v1.0.5

Published

Helps you to retrieve emails from S3 bucket

Downloads

4

Readme

AWS EMAIL RECEIVER

In order to receive emails, you should follow the instruction below

Installation

npm install aws-receive-email

Usage

const AWSEmailReceiver = require('email-receive');

AWSEmailReceiver.init(app,{"bucket":"","accessKeyId":"","secretAccessKey":""});
AWSEmailReceiver.emailReceived.subscribe(data=>{
	// console.log(data);
	AWSEmailReceiver.readEmail(data.to,data.mailId)
	.then(email => {
		console.log(email);
	})
	.catch(err => {
		console.log(err);
	});
});

DELETING EMAIL

AWSEmailReceiver.deleteEmail(data.to,data.mailId)
	.then(email => {
		console.log(email);
	})
	.catch(err => {
		console.log(err);
	});

EMAIL DATA

mail object

Parsed mail* object has the following properties

  • headers – a Map object with lowercase header keys
  • subject is the subject line (also available from the header mail.headers.get(‘subject’))
  • from is an address object for the From: header
  • to is an address object for the To: header
  • cc is an address object for the Cc: header
  • bcc is an address object for the Bcc: header (usually not present)
  • date is a Date object for the Date: header
  • messageId is the Message-ID value string
  • inReplyTo is the In-Reply-To value string
  • reply-to is an address object for the Cc: header
  • references is an array of referenced Message-ID values
  • html is the HTML body of the message. If the message included embedded images as cid: urls then these are all replaced with base64 formatted data: URIs
  • text is the plaintext body of the message
  • textAsHtml is the plaintext body of the message formatted as HTML
  • attachments is an array of attachments

address object

Address objects have the following structure:

  • value an array with address details

    • name is the name part of the email/group
    • address is the email address
    • group is an array of grouped addresses
  • text is a formatted address string for plaintext context

html is a formatted address string for HTML context

AWS SETUP

  • Login AWS console
  • Open SES
  • Click on "Rule Sets" below the "Email Receiving" section on the left menu
  • Enter the rule set name
  • Select the created rule set
  • Click on "Create Rule" button on the opened window
  • Enter the recipient email
  • Once entered it will ask you to confirm domain by entering confirmation DNS record and MX record pointing to the amazon
  • Once confirmation and MX record is completed you will see a verified sign beside the entered email
  • Click on "Next" button bottom right-hand side of the screen to continue setting up the action
  • From the dropdown of "Add action" select the "S3"
  • Once you select "S3" it will show you different fields to fill
  • Create a unique bucket name
  • Enter a prefix (I use the same as email generally)
  • Select and SNS (if don't have any follow below to create one)
    • Find SNS service section
    • Click on "Topics" from the left menu then click on the "Create Topic" button
    • Give your topic a proper name and display name
    • After the topic created select your topic and click on the "Create Subscription" button from the opened window
    • On this screen select HTTP or HTTPS from the protocol
    • Enter the main domain you are going to run the "aws-receive-email" module and add the "/aws-email-receiver" router to the URL it should look something like this (http://example.com/aws-email-receiver)
    • Once you click on "Create subscription" it will send a post request to that URL, if the app was already running with the module, it should verify subscription right away, otherwise; once you placed the app on the correct URL, you can select the subscription and click on "Request Confirmation" to trigger submission of SubscriptionConfirmation notification
  • Once all setup completed on SES and SNS you can send a test email to receive a detail of email on your application and emails are stored on s3, there is also a function to delete the email as well.