def body_to_s()
body = Array.new()
if(!multipart?())
return(@text)
else
body << "This is a multi-part message in MIME format.\r\n\r\n--#{@attachmentboundary}\r\nContent-Type: multipart/alternative; boundary=\"#{@bodyboundary}\""
if(@attachments.length > 0)
body << "#{buildbodyboundary("text/plain; charset=#{@charset}; format=flowed", 'quoted-printable')}\r\n\r\n#{quote_if_necessary(@text, @charset)}"
if @html
body << "#{buildbodyboundary("text/html; charset=#{@charset}", 'quoted-printable')}\r\n\r\n#{quote_if_necessary(@html, @charset)}"
end
body << "--#{@bodyboundary}--"
if(@attachments.length > 0)
@attachments.each() { |attachment|
body << "#{buildattachmentboundary(attachment)}\r\n\r\n#{attachment['attachment']}"
}
body << "\r\n--#{@attachmentboundary}--"
end
else
body << "#{buildbodyboundary("text/plain; charset=#{@charset}; format=flowed", 'quoted-printable')}\r\n\r\n#{quote_if_necessary(@text, @charset)}"
body << "#{buildbodyboundary("text/html; charset=#{@charset}", 'quoted-printable')}\r\n\r\n#{quote_if_necessary(@html, @charset)}"
body << "--#{@bodyboundary}--"
end
return(body.join("\r\n\r\n"))
end
end