# Mail: modifing a body

**URL:** <https://www.ruby-forum.com/t/mail-modifing-a-body/179898>\
**Category:** Ruby\
**Created:** [December 7, 2009, 5:41pm UTC](https://www.ruby-forum.com/t/mail-modifing-a-body/179898 "2009-12-07T17:41:33Z")\
**Posts on this page:** 1\
**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:** [December 7, 2009, 5:41pm UTC](https://www.ruby-forum.com/t/mail-modifing-a-body/179898/1 "2009-12-07T17:41:33Z")

</div>

I’ve a multipart mail, i parse it creating a Tmail object.  
In the body i have “—start—” “—end—” marks that indicates a part  
of  
the text to delete.  
If i read the email and then deliver it without touching the body, it  
sends  
the correct mail (html format, attachments and so on)  
If i do someting like:  
mail.body=mail.body[0,mail.index("—start—")]+mail.body[mail.body.index("—end—",mail.body.length]  
when i send that mail i lost every html format and multipart data.

How modify the body without loosing the rest?
