Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lsegal/mmmail
Mmm, a Minimalist mail library for Ruby. Works with SMTP or sendmail. Provides a one-call method for simple one-off emailing.
https://github.com/lsegal/mmmail
Last synced: about 2 months ago
JSON representation
Mmm, a Minimalist mail library for Ruby. Works with SMTP or sendmail. Provides a one-call method for simple one-off emailing.
- Host: GitHub
- URL: https://github.com/lsegal/mmmail
- Owner: lsegal
- License: mit
- Created: 2009-02-22T09:52:06.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2009-11-17T20:07:41.000Z (about 15 years ago)
- Last Synced: 2024-05-02T05:33:32.023Z (8 months ago)
- Language: Ruby
- Homepage: http://lsegal.github.com/mmmail
- Size: 180 KB
- Stars: 9
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
MmMail
======Mmmm, a Minimalist mail library for Ruby. Works with SMTP or sendmail.
One method call to send out emails. You're done. Easy tastes good. Oh,
and it works with Ruby 1.9.Join the discussion: #mmmail on freenode
Install
-------$ git clone git://github.com/lsegal/mmmail
$ cd mmmail
$ rake installor use GitHub gems:
$ sudo gem install lsegal-mmmail --source http://gems.github.com
Use
---**An easy example**:
require 'mmmail'
MmMail.send(to: '[email protected]', from: '[email protected]',
subject: 'hello joe', body: <<-eof)
Hey Joe,
You left the kitchen light on.
It started a fire and burned down your house.
Have fun in Hawaii.
Jake.
eof
Yes, that's Ruby 1.9 syntax, get used to it. It should work out
with the inferior 1.8 hash syntax too.**More complex stuff, like using sendmail instead of Net::SMTP:**
require 'mmmail'
MmMail::Transport::DefaultConfig.method = :sendmail
MmMail.send(...)
Okay it wasn't that hard. You can also specify the path to sendmail withMmMail::Transport::DefaultConfig.sendmail_binary = '/bin/sendmail'
**Dealing with SMTP auth and separate hosts:**
My ISP makes me do this:
require 'mmmail'
config = MmMail::Transport::DefaultConfig
config.host = 'smtp.myisp.com'
config.port = 587
config.auth_type = :plain # or :md5cram or :login
config.auth_user = 'myuser'
config.auth_pass = 'mypass'Yours might too. Okay, it doesn't make me do *all* of that, but these are
just examples, right?You can also create a `MmMail::Transport::Config` object to pass to `#mail`
if you need multiple configurations:config = MmMail::Transport::Config.new
config.host = 'mail.someOtherIspHost.com'
MmMail.send({options: here}, config)
# or
msg = MmMail::Message.new(to: '...', from: '...', subject: '...', body: '...')
transport = MmMail::Transport.new(config)
transport.send(msg, config)
Documentation
-------------[http://lsegal.github.com/mmmail/doc](http://lsegal.github.com/mmmail/doc)