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 leo.mmcm@gmail.com (4245ms)

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

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

Walter Davis wrote in post #1019034:

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