Problems getting ActionMailer working (on server)


#1

Hi,

I’ve read the Agile Rails book’s chapter on ActionMailer a few times.
Seems pretty straight forward. Unfortunately I can’t get my
application to actually send mail.

I uploaded my application to the web server and tried to get a mail
message sent. Nothing happened. I looked in the log file and it says

Sent mail:
From: removed_email_address@domain.invalid
To: removed_email_address@domain.invalid
Bcc: removed_email_address@domain.invalid
Subject: Freedom Kilts Order Confirmation
Content-Type: text/plain; charset=utf-8

and I don’t see any errors. Does this mean that the rails app was
happy and able to connect to the mail server?

In my configuration.rb file I have (where password is actually visible
and correct). I am able to log into the webmail with this username and
password so I think that part is ok. I also tried without the “mail.”
part in :domain.

ActionMailer::Base.delivery_method = :stmp

ActionMailer::Base.server_settings = {
:address => “mail.freedomkilts.com”,
:port => 25,
:domain => “mail.freedomkilts.com”,
:authentication => :login,
:user_name => “removed_email_address@domain.invalid”,
:password => “********”
}

ActionMailer::Base.default_charset = “utf-8”

When I use the create_order() method and look at the generated email
everything looks ok. I have switched this to deliver_order().

Any ideas? Getting ActionMailer working has been a much too long project
for me.

Thanks,
Peter


#2

In case it matters, I don’t know how to restart my rails app on the
monsterhosting.ca webserver since I never had to start it in the first
place. It just seems to run. So I don’t even know if my environment
changes are taking affect when I make them.

Thanks,
Peter


#3

Anyone have any ideas? I’ve been struggling with this email problem for
hours.
Thanks,
Peter


#4

Hi Ray,

Thank you for the information. I am amazed this is such a difficult
problem. In PHP all I need to do is something little like

mail($content, $to, $from)

I’ll keep trying.

Thanks,
Peter


#5

Peter M. wrote:

Anyone have any ideas? I’ve been struggling with this email problem for hours.

There are so many mail configurations that this is hard problem to solve
with the provided information. It’s also pretty hard to solve this type
of problem without shell access, and that you don’t even know if your
config changes are being entered makes it a bear.

  1. Try to figure out how to make config changes take effect. See if you
    can access the server logs. Double check the docs your host provides. If
    you don’t know if the changes are applied, you are wasting your time. If
    your host is not helpful, just upload a broken config file and see if
    that breaks your app. Be ready to roll it back.

Once that is clear,

  1. Are you sure the delivery method is smtp?

  2. Since you are sending mail from the host, you aren’t using
    authentication, comment out that line, and the password.

  3. The user_name that you configure will be the sender of the mail.
    Depending on how things are configured, and where the error is, the mail
    might be returned to that address. Is that address a mail box where you
    can read the mail.

  4. Are you sure you don’t have access to the server logs? What about the
    mail logs?

Ray