Forum: Ruby on Rails ActionMailer Sends Multiple Messages

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Richard S. (Guest)
on 2009-03-26 04:47
When i use "MyMailer.deliver_reply()" in my console, I send an email
exactly as i would expect, but when i call "MyMailer.deliver_reply()"
inside of my receive method, my app sends multiple duplicate messages,
Do you have any clue what may be causing this behavior?

Here is a copy of my log file

Here is some pseudo code of what my mailer looks like:

class MyMailer < ActionMailer::Base
    def receive(email)
        # code to store email information

    def reply(to_email)
       # code to send email, works great when called through console

This mailer takes in an email stores it, and then thanks the sender for
sending something automatically
Richard S. (Guest)
on 2009-06-27 00:09
So it's been awhile since i posted this question. I'm not 100% on why
its sending multiple emails, i believe it may be interperting both the
plaintext and html version of the email, as seperate entities, or it may
be a bug in mailer fetcher daemon. Either way, i ended up writing the
incoming emails to a database, then checking to make sure we had a
unique to_email with scope: => [:body]. once i did that, and put an if
statement into my receive method, everything worked fine. If you have
any guesses why its seeing four messages when its only supposed to see
one, please let me know.
This topic is locked and can not be replied to.