# Sending email with attachments

**URL:** <https://www.ruby-forum.com/t/sending-email-with-attachments/194093>\
**Category:** Rails\
**Created:** [August 30, 2010, 8:43am UTC](https://www.ruby-forum.com/t/sending-email-with-attachments/194093 "2010-08-30T08:43:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [August 30, 2010, 8:43am UTC](https://www.ruby-forum.com/t/sending-email-with-attachments/194093/1 "2010-08-30T08:43:03Z")

</div>

Hi

Could anyone please give an example of sending mails with attachments in  
rails using actionmailer?  
I have a user in users table whose attachments is stored in  
attachments table it self( Relation is user has\_many attachments ;  
attachment belongs\_to user). Sender for example is removed\_email\_address@domain.invalid.  
suppose user1 has two attachments “test1.pdf” and “test2.doc”

Thanks  
Tom

---

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [August 30, 2010, 10:06am UTC](https://www.ruby-forum.com/t/sending-email-with-attachments/194093/2 "2010-08-30T10:06:41Z")

</div>

Hi  
A detailed requirement of the above is as

I have a message model, message\_participant model, and attachments  
model. The relations are

message has\_many message\_participants  
message has\_many attachments

attachment using paperclip I am storing in database it self. I have  
in hand a message object which has subject, body etc. So clearly this  
message has a sender and many recipients. This I can find out. My  
requirement is to send each of the message recipients this message with  
its attachments

I have all the data in my hand . What I need is, to send same email  
with attachments to the recipients

```
Please help

```

Thanks  
Tom
