Skip to content

A simple small http interface which accepts E-Mails and sends them to whereevery you want!

License

Notifications You must be signed in to change notification settings

schmidigital/http-mail-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http-mail-client

A simple small http interface which accepts E-Mails and sends them to whereevery you want!

Just use the config.sample.json and there you go!

example is provided in the example folder! :)

TLDR:

  1. Copy the example folder to your app and fit the config to your needs

  2. You have 2 possibilities to start the server

    1. Start your server with "node mailer.js"
    1. Fit the docker-compose.yml to your needs and start your server with "docker-compose up -d" In case you want to use docker, I recommend you to use "jwilder reverse proxy", so you can run your http mail client very easily on a domain like 'mailer.my-domain.com'.
  3. Now pass the data to your http-mail-client

Example config.json

{
  "smtp": {
    "host": "mail.foo.de",
    "user": "[email protected]",
    "password": "1234haha",
    "port": 465
  },
  "allowed_sender": [{
    "domain": "website-where-your-script-is-launched.com", // the script will only allow requests from this domain. For local development, just enter 'localhost'
    "email": "[email protected]", // the script will only allow this email as valid sender.
    "smtp": { // These are the credentials for your smtp server
      "user": "[email protected]",
      "password": "awesomepassword",
      "host": "smtp.my-server.com",
      "port": 587
    }
  }]
}

Example Http Request

let mail = {
  from: '[email protected]',
  to: '[email protected]',
  replyTo: '[email protected],
  subject: '✉️ Contact Request from Hermine Granger',
  text: {
    plain: message.plain,
    html: message.html
  }
};

*Important*

// This is an example using Angular 2 HTTP POST Query. Works with any other http library too, ofc ;-).
// Just use the 'mail' object as your body.
this.http.post('https://mailer.schmid.digital', mail)
  .subscribe(res => console.log('response', res))

If you have any questions, feel free to open an issue on github!

About

A simple small http interface which accepts E-Mails and sends them to whereevery you want!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published