cerebris/mailhopper — Issue #4: Email body too long - Mysql text column handles only 64kb
Author: holli
Created: 2012-02-12 14:59:39+00:00
State: open

We had some complaints that emails were cut off from the middle. After a while of debugging we realized that content column is saved as text. Mysql text takes only 64kb. (http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html)

64kb can be easily reached with a longer html message. And its definitely is reached if you have any attachments.

I guess Postgresql has no limit?

## Solutions

Force longtext column in mysql. Add following to migration
https://github.com/cerebris/mailhopper/blob/master/lib/generators/mailhopper/templates/migrations/create_emails.rb#L19

t.text :content, :limit => 100.megabytes

Rails sql handler will use the right columns depending on the sql server. 100.megabytes is probably a good limit?

Also readme.md could have some info:

Generate default initializer and migration files: `rails generate mailhopper`. Default max-size for content is 100.megabytes. Depending on your needs and sql server you can modify the migration.

Btw, thanks for the gem, has helped a lot :)