# Sending emails

**URL:** <https://www.ruby-forum.com/t/sending-emails/134509>\
**Category:** Ruby\
**Created:** [April 11, 2008, 3:33pm UTC](https://www.ruby-forum.com/t/sending-emails/134509 "2008-04-11T15:33:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mickey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ccd318/32.png) [@mickey](https://www.ruby-forum.com/u/mickey)\
**Post date:** [April 11, 2008, 3:33pm UTC](https://www.ruby-forum.com/t/sending-emails/134509/1 "2008-04-11T15:33:18Z")

</div>

Is there a gem for sending emails?

I want to automate a process for sending emails containing images. I  
have it running in perl using Mime::Lite, and I was hoping that there  
was something similar in Ruby.

---

<div class="post-metadata">

**Author:** ![mickey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ccd318/32.png) [@mickey](https://www.ruby-forum.com/u/mickey)\
**Post date:** [April 11, 2008, 4:24pm UTC](https://www.ruby-forum.com/t/sending-emails/134509/2 "2008-04-11T16:24:15Z")

</div>

have a look at ActionMailer:

> **[ActionMailer::Base](https://api.rubyonrails.org/classes/ActionMailer/Base.html)**
>
> Action Mailer allows you to send email from your application using a mailer model and views. Mailer Models To use Action Mailer, you need to create a mailer model.

look for attachment, this should allow to add images, i guess (didn’t  
try it, though)

---

<div class="post-metadata">

**Author:** ![mickey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ccd318/32.png) [@mickey](https://www.ruby-forum.com/u/mickey)\
**Post date:** [April 11, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/sending-emails/134509/3 "2008-04-11T16:44:32Z")

</div>

On Fri, 11 Apr 2008 23:24:16 +0900  
Thorsten M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> have a look at ActionMailer:  
> [ActionMailer::Base](http://api.rubyonrails.org/classes/ActionMailer/Base.html)
> 
> look for attachment, this should allow to add images, i guess (didn’t  
> try it, though)

But surely that is a Rails solution, not a Ruby solution?

---

<div class="post-metadata">

**Author:** ![mickey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ccd318/32.png) [@mickey](https://www.ruby-forum.com/u/mickey)\
**Post date:** [April 11, 2008, 6:44pm UTC](https://www.ruby-forum.com/t/sending-emails/134509/4 "2008-04-11T18:44:08Z")

</div>

On Fri, Apr 11, 2008 at 10:43 AM, David A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> On Fri, 11 Apr 2008 23:24:16 +0900  
> Thorsten M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > have a look at ActionMailer:  
> > [ActionMailer::Base](http://api.rubyonrails.org/classes/ActionMailer/Base.html)
> > 
> > look for attachment, this should allow to add images, i guess (didn’t  
> > try it, though)
> 
> But surely that is a Rails solution, not a Ruby solution?

actionmailer is a separate gem like activerecord.

I believe that, like activerecord, it can be used independently of  
Rails, although I’ve not done that personally.

–  
Rick DeNatale

My blog on Ruby  
[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![mickey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ccd318/32.png) [@mickey](https://www.ruby-forum.com/u/mickey)\
**Post date:** [April 11, 2008, 8:17pm UTC](https://www.ruby-forum.com/t/sending-emails/134509/5 "2008-04-11T20:17:38Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

David A. wrote:  
| On Fri, 11 Apr 2008 23:24:16 +0900  
| Thorsten M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
|  
|\> have a look at ActionMailer:  
|\> [ActionMailer::Base](http://api.rubyonrails.org/classes/ActionMailer/Base.html)  
|\>  
|\> look for attachment, this should allow to add images, i guess (didn’t  
|\> try it, though)  
|  
| But surely that is a Rails solution, not a Ruby solution?  
|

No reason that ActonMailer is limited to Eails alone. 😉

However, I’d cut out the middleman, and go for tmail directly.

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)

Abstain from wine, women, and song; mostly song.  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkf/quUACgkQbtAgaoJTgL8iCwCeIpyJ1KEbspFslxlhuFX4N3Zm  
//kAnjgyJAVKGHsAy+/SOE2Ej4jKUI7G  
=Vj7b  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![mickey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ccd318/32.png) [@mickey](https://www.ruby-forum.com/u/mickey)\
**Post date:** [April 11, 2008, 8:43pm UTC](https://www.ruby-forum.com/t/sending-emails/134509/6 "2008-04-11T20:43:28Z")

</div>

On Fri, Apr 11, 2008 at 1:16 PM, Phillip G.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> However, I’d cut out the middleman, and go for tmail directly.

You might also want to look at MailFactory

[http://rubyforge.org/projects/mailfactory/](http://rubyforge.org/projects/mailfactory/)

> **[Merb's Mailer is Awesome (if I do say so myself)](https://yehudakatz.com/2007/09/03/merbs-mailer-is-awesome-if-i-do-say-so-myself/)**
>
> A few months ago, when I first took a look at Merb, I noticed a distinct lack of
> support for email. There was a simple wrapper around MailFactory (a Ruby library
> that is, imho, superior to TMail, and actually documented to boot), but nothing
> like...

Gordon T.

---

<div class="post-metadata">

**Author:** ![mickey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ccd318/32.png) [@mickey](https://www.ruby-forum.com/u/mickey)\
**Post date:** [April 11, 2008, 9:18pm UTC](https://www.ruby-forum.com/t/sending-emails/134509/7 "2008-04-11T21:18:16Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Gordon T. wrote:  
| On Fri, Apr 11, 2008 at 1:16 PM, Phillip G.  
| [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
|\> However, I’d cut out the middleman, and go for tmail directly.  
|\>  
|  
| You might also want to look at MailFactory  
|  
| [http://rubyforge.org/projects/mailfactory/](http://rubyforge.org/projects/mailfactory/)  
|  
[Merb's Mailer is Awesome (if I do say so myself)](http://yehudakatz.com/2007/09/03/merbs-mailer-is-awesome-if-i-do-say-so-myself/)

Oh, that looks good. Thanks for the tip. 🙂

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)

~ “When life gives you a lemon, make lemonade.” -Susie “I say, when  
life gives you a lemon, wing it right back and add some lemons of your  
own!” -Calvin  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkf/uTwACgkQbtAgaoJTgL+hlwCcD6fuV9mF2063xK2e3Bkl4rdv  
crEAoIHjG4cwpqAY0mOM1vmeUIx4CaNX  
=KgNr  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![mickey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ccd318/32.png) [@mickey](https://www.ruby-forum.com/u/mickey)\
**Post date:** [April 11, 2008, 7:52pm UTC](https://www.ruby-forum.com/t/sending-emails/134509/8 "2008-04-11T19:52:23Z")

</div>

On 11 Apr 2008, at 15:43, David A. wrote:

> On Fri, 11 Apr 2008 23:24:16 +0900  
> Thorsten M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > have a look at ActionMailer:  
> > [ActionMailer::Base](http://api.rubyonrails.org/classes/ActionMailer/Base.html)
> > 
> > look for attachment, this should allow to add images, i guess (didn’t  
> > try it, though)
> 
> But surely that is a Rails solution, not a Ruby solution?

How about EventMachine with it’s SmtpClient, I love it 🙂
