GithubHelp home page GithubHelp logo

smitty's Introduction

Smitty

Smitty is a mail client that allows you to use handlebars like HTML templates. It supports all the things you would expect out a mail client. Internally it uses mail for creation and premailer for inline css. Generation for Multi-Part messages is all done for you.

Smitty doesn't use everything that is available in handlebars, it only does replacement for variables. What this allows you to do is create nice looking HTML templates in a proper editor, and then do quick search and replace.

For example, say you wanted to loop over a set of emails and names, inserting a different name for the corresponding email. In your template, you would put {{name}} in the place where you wanted replacement to occur, write your names and email addresses in 'names.txt' and 'emails.txt' respectively, and call smitty like so. Assume your template is in template.hbs.

./smitty [email protected] emails.txt 'YO {{name}}' template.hbs --vars 'name=names.txt' 

Smitty would then loop over each email address in emails.txt, replacing {{name}} with the corresponding name from names.txt. As you can see, variable names in the subject is also supported.

Content-ID Embedded Images

Smitty includes the ability to generate Content-ID values for attached images and embed the content within the handlebars HTML template in accordance with RFC2557. Smitty will generate a Multi-Part email message and search the handlebar HTML template for image references associated with the attached image name.

./smitty [email protected] emails.txt 'Subject' -a someimage.jpg --cid tempalte.hbs

Smitty will then search through the template and replace references to <img src="cid:{{someimage.jpg}}"> with the Content-ID value of the attached image.

Installation

$ gem install smitty

Or build and install it yourself as:

$ gem build smitty.gemspec
$ gem install smitty

Usage

Smitty 1.0.0

Usage:
  smitty [options] <from_address> <to_file> <subject> <template>
  smitty -h | --help
  smitty -v | --version

Required Arguments:
  from_address:                    Address to send mail from.
  to_file:                         Newline separated file containing recipient addresses.
  subject:                         Mail subject, can have handlebar replacements.
  template:                        Handlebars like HTML template.

Options:
  -h --help                        Show this usage.
  -v --version                     Show version.
  --vars key=value,key=value       Variables for template and subject line, should be a comma separated
                                   list of key value pairs. Key should be the variable name in your
                                   template, and value may be a constant or a newline separated file.
                                   Value file and to_file must have the same amount of lines.
  -a files                         Attach comma separated list of files.
  --cid                            Enable CID embedding of images for email attachments, default is false.
  --server SERVER                  SMTP Server, default is localhost.
  --port PORT                      SMTP Port, default is 25.
  --ssl                            Use SSL, default is false.
  --username USER                  SMTP user.
  --password PASSWORD              SMTP password.
  --cc address                     Add a cc address.
  --bcc address                    Add a bcc address.
  --messageid FQDN                 Set a FQDN to use when generating the message-id for each message.
  --sleep SEC                      Sets sleep delay, in seconds, per each recipent.
  --dry-run                        Output messages and don't send.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

smitty's People

Contributors

tomsteele avatar mattburch avatar

Watchers

unbaiat avatar

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.