# Problem with attached log file using ActionMailer

**URL:** <https://www.ruby-forum.com/t/problem-with-attached-log-file-using-actionmailer/139417>\
**Category:** Rails\
**Created:** [June 3, 2008, 6:20pm UTC](https://www.ruby-forum.com/t/problem-with-attached-log-file-using-actionmailer/139417 "2008-06-03T18:20:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cobra050](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/3d9bf3/32.png) [@cobra050](https://www.ruby-forum.com/u/cobra050)\
**Post date:** [June 3, 2008, 6:20pm UTC](https://www.ruby-forum.com/t/problem-with-attached-log-file-using-actionmailer/139417/1 "2008-06-03T18:20:45Z")

</div>

Hi, all

I am new to the Rails. I am trying to use ActioanMailer to send an  
email with a log file attached. However, after I received the email, I  
found out that the format in the log file is messed up. The orginal log  
file is well formated that information is written line by line.  
Everything is written in one line in the log file I received from the  
email.

Here’s my code:

class SimpleMailer \< ActionMailer::Base  
def simple\_message(recipient)  
from ‘removed\_email\_address@domain.invalid’  
recipients recipient  
subject ‘test’  
body ‘test’

```
attachment :content_type =>"text/plain",
                 :filename => "test.log",
                  :body => File.read("c:\\test.log")

```

end  
end

Is there any way to format the log file attached?

Thanks
