problem with association

Here's a hint: Your User model has_many :mails, but a user really
has_many :sent_mails and has_many :received_mails. You'll need to set
the foreign_key attributes.