Skip to content

GitHub action to setup an smtp server that saves emails to mongo, uses mailparser's `ParsedMail` as document schema. Intended only for development and test workflows.

License

Notifications You must be signed in to change notification settings

debdutdeb/smtp-to-mongo-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMTP to MongoDB

GitHub action to setup an smtp server that saves emails to mongo, uses mailparser's ParsedMail as document schema. Intended only for development and test workflows.

Usage

Add the following to your workflow file to get smtp server running

steps:
- uses: debdutdeb/smtp-to-mongodb-action@main
  with:
    log-file: /tmp/smtp.log
    mongo-url: mongodb://localhost:27017

You can use supercharge/[email protected] with this action to get a mongo instance running.

Recommended structure is

steps:
- uses: supercharge/[email protected]
  with:
    mongodb-version: "5.0"

- uses: debdutdeb/smtp-to-mongodb-action@main
  with:
    log-file: /tmp/smtp.log
    mongo-url: mongodb://localhost:27017

# after using the server

- run: |
    cat /tmp/smtp.log
  if: failure()

Once SMTP server is running you can use the server with smtp://localhost:2525, with no auth and tls.

By default emails are persisted on tests db, emails_received collection.

Available options

input description default
port SMTP server port 2525
mongo-url MongoDB connection URL nil
log-file Where to save failure logs nil
database-name Database name in MongoDB tests
collection-name Collection in MongoDB emails_received

If using TypeScript/JavaScript, you can use this file to access the emails.

Document type for each email is ParsedMail.

About

GitHub action to setup an smtp server that saves emails to mongo, uses mailparser's `ParsedMail` as document schema. Intended only for development and test workflows.

Resources

License

Stars

Watchers

Forks

Packages

No packages published