# (heeeelp) sending an email as attachment

**URL:** <https://www.ruby-forum.com/t/heeeelp-sending-an-email-as-attachment/176150>\
**Category:** Ruby\
**Created:** [September 25, 2009, 10:20am UTC](https://www.ruby-forum.com/t/heeeelp-sending-an-email-as-attachment/176150 "2009-09-25T10:20:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rabarama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/839c29/32.png) [@rabarama](https://www.ruby-forum.com/u/rabarama)\
**Post date:** [September 25, 2009, 10:20am UTC](https://www.ruby-forum.com/t/heeeelp-sending-an-email-as-attachment/176150/1 "2009-09-25T10:20:38Z")

</div>

Problem: i get an email from a pop3 mailbox, i want to send it as an  
attachment in another mail.

I get via Net::pop a mail  
i handle it via Tmail::mail

if i use this code, the attachment i receive is visible only via  
outlook or  
other clients, webmails as gmail or yahoo can’t open the attachment

i call the action mailer in this way

m is the mail NET::POP  
mail is the tmail object

mailer\_create\_mail(tmail.to\_s)

attachment :content\_type =\> "message/rfc822", :filename =\>"new\_email.eml", :body =\> mail

Is there a way to encode the mail in a way every client can open it?

---

<div class="post-metadata">

**Author:** ![rabarama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/839c29/32.png) [@rabarama](https://www.ruby-forum.com/u/rabarama)\
**Post date:** [September 25, 2009, 10:25am UTC](https://www.ruby-forum.com/t/heeeelp-sending-an-email-as-attachment/176150/2 "2009-09-25T10:25:54Z")

</div>

> m is the mail NET::POP  
> mail is the tmail object
> 
> mailer\_create\_mail(tmail.to\_s)

sorry,  
mailer\_create\_mail(mail.to\_s)

and the same result i get if i use

mailer\_create\_mail(m.pop)
