GithubHelp home page GithubHelp logo

pistos / mailit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from manveru/mailit

2.0 3.0 1.0 94 KB

Mailit is a simple to use library to create and send MIME compliant e-mail with attachments and various encodings

Ruby 100.00%

mailit's Introduction

Mailit

Mailit is a simple to use library to create and send MIME compliant e-mail with attachments and various encodings.

This is a fork of MailFactory and provides a mostly identical API but has been cleaned up, simplified, and made compliant to common Ruby idioms. I would like to thank David Powers for the original MailFactory, it served me well for many years.

Copyright (c) 2005-2008 David Powers. Copyright (c) 2009 Michael Fellinger.

This program is free software. You can re-distribute and/or modify this program under the same terms as Ruby itself.

Dependencies

Any Ruby since 1.8.4 should work. Mailit can use the Rack or Mime::Types libraries to determine the mime-type of attachments automatically, but they are optional.

Usage of Mailit::Mail

require 'net/smtp'
require 'mailit'

mail = Mailit::Mail.new
mail.to = '[email protected]'
mail.from = '[email protected]'
mail.subject 'Here are some files for you!'
mail.text = 'This is what people with plain text mail readers will see'
mail.html = "A little something <b>special</b> for people with HTML readers'
mail.attach('/etc/fstab')
mail.attach('/home/manveru/.vimrc')

puts mail

Usage of Mailit::Mailer

Using the mail variable from above example

mailer = Mailit::Mailer.new

mailer.send(mail, :server => 'smtp.example.com', :port => 25,
            :domain => 'example.com', :password => 'foo')

Todo:

MailFactory has a method_missing that handles getting and setting of arbitrary headers. I went for the less magical #[] and #[]= methods, maybe someone can add the MailFactory behaviour.

Thanks to

  • Michael Thompson (AKA:nylon)

    Making mailer work on windows

mailit's People

Contributors

manveru avatar jakedouglas avatar

Stargazers

Pistos avatar

Watchers

Pistos avatar James Cloos avatar  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.