class Mail::Message

def body=(value)

mail.parts.last.content_type.content_type #=> 'This is a body'
mail.parts.length #=> 2
mail.body = "This is a body"
mail.parts.length #=> 1
mail.add_file 'somefilename.png'

your email:
of deleting all the parts of your email, mail will add a text/plain part to
If you try and set the body of an email that is a multipart email, then instead

mail.body.encoded #=> ''
mail.body = nil
mail.body.encoded #=> 'this is the body'
mail.body = 'this is the body'

Example:

You can also reset the body of an Message object by setting body to nil

mail.body #=> #def body=(value) body_lazy(value) end