Having an Action Mailer that doesn't mail

…is like to have a cutter that doesn’t cut! :slight_smile:

Hello, I’m working on Action Mailer, with a simple email confirmation
when a user signs up.

So, basically when I try to register myself on my local server, the
registration goes just fine, without errors nor failures, but I
ultimately don’t receive any email from myself, even though the app is
supposed and structured to do so.

For instance , I have the Notifier model structured so :

class Notifier < ActionMailer::Base
default :from => “###MY EMAIL###”

def welcome(user)

@user = user

mail (:to => user.email , :subject => "Signed up successfully")

end
end

…and my UserController :

def create
@user = User.new(params[:user])

respond_to do |format|
  if @user.save
    Notifier.welcome(@user).deliver
    format.html { redirect_to(@user, :notice => "User #{@user.name }

was successfully created.") }
format.xml { render :xml => @user, :status => :created,
:location => @user }
else
format.html { render :action => “new” }
format.xml { render :xml => @user.errors, :status =>
:unprocessable_entity }
end
end
end

I’ve got a Gmail account , and in my environments/development.rb I
configured the gmail account in this way :

config.action_mailer.smtp_settings = {
:address => “smtp.gmail.com”,
:port => 587,
:domain => “gmail.com”,
:authentication => “plain”,
:user_name => “MY EMAIL”,
:password => ‘#MY PASSWORD’,
:enable_starttls_auto => true
}

Any idea???

Thank you very much!
Leo

Are you running the server in development mode? Are you getting any
errors
in your log?

Nope, the log shows a -I guess- normal session :

Sent mail to [email protected] (4245ms)
Date: Mon, 29 Aug 2011 14:39:43 +0200
From: [email protected]
To: [email protected]
Message-ID: [email protected]
Subject: Iscrizione completa!
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit

Redirected to http://0.0.0.0:3000/users/46
Completed 302 Found in 4711ms

The really weird thing is that I tried to send an email to a fake
address, and then, in that case I receive an email from Email Delivery
Subsystem, with the normal notice about an inexistent domain, so it
means that ActionMailer actually works, but for some reason I’m not able
to receive the email I send to myself.
I can’t see any evident clue in here, let me know if you see one :

Delivery to the following recipient failed permanently:

[email protected]

Technical details of permanent failure:
DNS Error: Domain name not found

----- Original message -----

Received: by 10.227.38.22 with SMTP id z22mr2606056wbd.7.1314614527794;
Mon, 29 Aug 2011 03:42:07 -0700 (PDT)
Return-Path: [email protected]
Received: from gmail.com (93-45-120-143.ip102.fastwebnet.it
[93.45.120.143])
by mx.google.com with ESMTPS id
fd4sm3622444wbb.30.2011.08.29.03.42.05
(version=TLSv1/SSLv3 cipher=OTHER);
Mon, 29 Aug 2011 03:42:06 -0700 (PDT)
Date: Mon, 29 Aug 2011 12:45:06 +0200
From: [email protected]
To: [email protected]
Message-ID: [email protected]
Subject: Iscrizione completa!
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit

Right, this is weird.

I didn’t change a single line and tried again to register with the usual
email address and this time I received the message!

Some conflict at ISP level maybe? Could be?

Thank you guys,
Leo

On Aug 29, 2011, at 8:43 AM, Leo M. wrote:

charset=UTF-8
to receive the email I send to myself.

Date: Mon, 29 Aug 2011 12:45:06 +0200
From: [email protected]
To: [email protected]
Message-ID: [email protected]
Subject: Iscrizione completa!
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit

Is this mail being sent/received on a DSL/Cable modem? Your ISP may be
filtering mail sent directly by your computer as an anti-spam measure.

Since you entered an intentionally garbled address as a testing
measure, then your localhost might not have been able to forward it to
the next hop, and the error message may have come from whatever you
use for sendmail on your local computer.

In the case of a well-formed message, your machine may have sent it on
to the next mailserver in the chain, which would be your ISP, and they
looked at it, decided you were not a real server, and dropped it on
the floor without comment.

Now if you’re sending from a real server with an MX record and
everything, then I have no idea.

Walter

On Aug 29, 2011, at 9:16 AM, Leo M. wrote:

Subject: Iscrizione completa!

looked at it, decided you were not a real server, and dropped it on
:slight_smile:
A pity though, I would have known where was the catch.

Thanks
Leo

Given what happened, I have yet another theory: My ISP (Speakeasy)
uses a method they call “graylisting” to cut down on spam. When they
receive an e-mail from an unknown or untrusted server, they send back
the WAIT(RandomNumberOfSeconds) command. Any real mail server knows
what to do with that, and they do. SpamBot2000 running on infected
Windows XP boxen (but I repeat myself!) don’t, and the mail is dropped
on the floor. You may have just encountered the RandomNumberOfSeconds
here. When testing locally, I send to my MobileMe account, which seems
to process all mail nearly instantaneously. My Speakeasy account and
my Gmail account (which forwards into it) have the delay effect, so I
never can tell if my mailer is working.

Walter

Walter D. wrote in post #1019034:

On Aug 29, 2011, at 8:43 AM, Leo M. wrote:

charset=UTF-8
to receive the email I send to myself.

Date: Mon, 29 Aug 2011 12:45:06 +0200
From: [email protected]
To: [email protected]
Message-ID: [email protected]
Subject: Iscrizione completa!
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit

Is this mail being sent/received on a DSL/Cable modem? Your ISP may be
filtering mail sent directly by your computer as an anti-spam measure.

Since you entered an intentionally garbled address as a testing
measure, then your localhost might not have been able to forward it to
the next hop, and the error message may have come from whatever you
use for sendmail on your local computer.

In the case of a well-formed message, your machine may have sent it on
to the next mailserver in the chain, which would be your ISP, and they
looked at it, decided you were not a real server, and dropped it on
the floor without comment.

Now if you’re sending from a real server with an MX record and
everything, then I have no idea.

Walter

Thank you for your reply.
IMO what you say is likely, but right now it’s somehow solved by itself
:°)
A pity though, I would have known where was the catch.

Thanks
Leo