diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index a716412f..5add41d7 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -39,7 +39,7 @@ class MailHandler < ActionMailer::Base # Processes incoming emails def receive(email) @email = email - @user = User.active.find(:first, :conditions => ["LOWER(mail) = ?", email.from.first.to_s.strip.downcase]) + @user = User.active.find_by_mail(email.from.first.to_s.strip) unless @user # Unknown user => the email is ignored # TODO: ability to create the user's account