Git Product home page Git Product logo

mod-mailer's Introduction

Vert.x 2.x is deprecated - use instead http://vertx.io/docs/vertx-mail-client/java/

Mailer

This module allows emails to be sent via SMTP.

Dependencies

This module requires a mail server to be available.

Name

The module name is mailer.

Configuration

The mailer module requires the following configuration:

{
    "address": <address>,
    "host": <host>,
    "port": <port>,
    "ssl": <ssl>,
    "auth": <auth>,
    "username": <username>,
    "password": <password>,
    "content_type": <content_type>
}

Let's take a look at each field in turn:

  • address The main address for the busmod. Every busmod has a main address.
  • host Host name or ip address of the mail server instance. Defaults to localhost.
  • port Port at which the mail server is listening. Defaults to 25.
  • ssl If true then use ssl, otherwise don't use ssl. Default is false.
  • auth If true use authentication, otherwise don't use authentication. Default is false.
  • username If using authentication, the username. Default is null.
  • password If using authentication, the password. Default is null.
  • content_type If you want to send HTML email body, then set to text/html. Default is text/plain.

For example, to send to a local server on port 25:

{
    "address": "test.my_mailer"
}

Or to a gmail account:

{
    "address": "test.my_mailer"
    "host": "smtp.googlemail.com",
    "port": 465,
    "ssl": true,
    "auth": true,
    "username": "tim",
    "password": "password"
}

Sending Emails

To send an email just send a JSON message to the main address of the mailer. The JSON message representing the email should have the following structure:

{
    "from": <from>,
    "to": <to|to_list>,
    "cc": <cc|cc_list>
    "bcc": <bcc|bcc_list>
    "subject": <subject>
    "body": <body>,
    "headers": <headers_list>
}

Where:

  • from is the sender address of the email. Must be a well-formed email address.
  • to to is either a single well formed email address representing the recipient or a JSON array of email addresses representing the recipients. This field is mandatory.
  • cc to is either a single well formed email address representing a cc recipient or a JSON array of email addresses representing the cc list. This field is optional.
  • bcc to is either a single well formed email address representing a bcc recipient or a JSON array of email addresses representing the bcc list. This field is optional.
  • subject is the subject of the email. This field is mandatory.
  • body is the body of the email. This field is mandatory.
  • headers is a JSON array of JSON object representing the name of an header and it's value. This field is optional.

For example, to send a mail to a single recipient:

{
    "from": "[email protected]",
    "to": "[email protected]",
    "subject": "Congratulations on your new armadillo!",
    "body": "Dear Bob, great to here you have purchased......"
}

Or to send to multiple recipients:

{
    "from": "[email protected]",
    "to": ["[email protected]", "[email protected]"],
    "subject": "Sadly, my aardvark George, has been arrested.",
    "body": "All, I'm afraid George was found...."
}

Or to send to multiple recipients with additional headers:

{
    "from": "[email protected]",
    "to": ["[email protected]", "[email protected]"],
    "subject": "Sadly, my aardvark George, has been arrested.",
    "body": "All, I'm afraid George was found....",
    "headers": [{"name": "X-My-Header","value": "Header's value"}]
}

mod-mailer's People

Contributors

hugocrd avatar jasonparekh avatar patoi avatar pidster avatar purplefox avatar vietj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mod-mailer's Issues

port problem

I become the failure with my test.py "Could not connect to SMTP host: mail.blubb.net, port: 25;"
But in config stay "port": 465,
I don't understand it :/

Headers support

We sometime need to add some custom headers to our mails (for tracking purpose for exemple).
The mailer mod could handle that for us.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.