voodoo-doll/mailman

Mailer

1.0 2014-05-28 08:26 UTC

README

MailMan is email service utility using AWS SES to send emails.

Beside sending regular mail, it can send pre-written email from template containing variables to be parsed upon sending.

How to use using a template

(new Voodoo\Doll\Mailman\Mailman)->template("welcome")->send("you@email.com");

How to use using a template and variables

$data = ["name" => "mardix"];

(new Voodoo\Doll\Mailman\Mailman)->template("welcome", $data)->send("you@email.com");

How to use as normal

(new Voodoo\Doll\Mailman\Mailman)
    ->from("me@email.com")
    ->replyTo("me@email.com")
    ->to("you@email.com")
    ->subject("Hi!")
    ->body("Hello you")
    ->send();

Template

Templates are simple text files that may handlebars markup.

Create /var/mailman under the root directory

To edit a template, create a .txt file into the /var/mailman directory.

Make sure the template has the variables: Subject and Body

Subject is the subject of the email

Body is the body of the email

  • Partials

You may include partial files in the body.

All partials must start with and _ (underscore)

To include a partial {{> parial_name}} without the underscore or extension

Example

welcome.txt

Subject = """Hello {{name}}"""
Body = """
This is the body of the message

{{> footer}}
"""

_footer.txt

Thank you!

Staff
  • Config

The config of Mailman is under conf/Doll.conf.php under the node [Mailman]

Required keys

[Mailman]
    from = "" ; from email
    name = "" ; name of the sender
    replyTo = "" ; reply to email
    templateDir = "/var/mailman" ; Dir holding mailman templates

Default email params:

You can add extra params to be added in your templates, such as the name of the site etc.

Under [Mailman] add params[$key]

[Mailman]
    ... previous config

    params[company_name] = "Company name"
    params[company_email] = "Company email"
...