Action Mailer Driving me insane

Ok, maybe its a short walk, not a drive...

I have it working just fine using smtp in development env from my OSX
machine. When I deploy it to the server (which happens to be the same
box where the smtp server lives), no email, no errors, nothing in the
Postfix logs.

I've double checked that my production and development action mailer
settings are identical. Here's whats in the production.rb

config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "mydomain.com",
:port => correct port,
:domain => "mydomain.com",
:authentication => :plain,
:user_name => "smtp_plain@mydomain.com",
:password => "the password"
}

When the app fires off an email, the rails log shows:
Sent mail to blah@jeffpritchard.com

but the postfix logs on the smtp server show absolutely nothing related
to this attempted email. When I send one from the development app
running on osx, I can easily find it in the postfix logs.

Help??? What could make actionmailer think everything is fine, and yet
the smtp server never even hears about it???

thanks,
jp

config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "mydomain.com",
:port => correct port,
:domain => "mydomain.com",
:authentication => :plain,
:user_name => "smtp_pl...@mydomain.com",
:password => "the password"

random guess - do you need 127.0.0.1 or something like that rather
than mydomain.com ? Sometimes smtp etc is firewall on the external
interface.

Fred

Frederick Cheung wrote:

config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "mydomain.com",
:port => correct port,
:domain => "mydomain.com",
:authentication => :plain,
:user_name => "smtp_pl...@mydomain.com",
:password => "the password"

random guess - do you need 127.0.0.1 or something like that rather
than mydomain.com ? Sometimes smtp etc is firewall on the external
interface.

Fred

Thanks Fred,
No joy. I even went so far as to put in "kungfoopanda.com" and verified
that on my local machine this gives me a delivery error, while on the
real server, no errors are generated. For some reason, action mailer is
not even trying to send it, but is claiming it has been sent.

;{
jp

Jeff Pritchard wrote:

Thanks Fred,
No joy. I even went so far as to put in "kungfoopanda.com" and verified
that on my local machine this gives me a delivery error, while on the
real server, no errors are generated. For some reason, action mailer is
not even trying to send it, but is claiming it has been sent.

;{
jp

Another clue. I just went back to the development machine and forced
script/server to run in production mode (script/server -e production),
and it still works from the Mac in production mode. I believe this
removes the onus from the production config; I'm not sure where to point
the finger now though.

thanks,
jp

Jeff Pritchard wrote:

>
> Thanks Fred,
> No joy. I even went so far as to put in "kungfoopanda.com" and verified
> that on my local machine this gives me a delivery error, while on the
> real server, no errors are generated. For some reason, action mailer is
> not even trying to send it, but is claiming it has been sent.
>
> ;{
> jp

Another clue. I just went back to the development machine and forced
script/server to run in production mode (script/server -e production),
and it still works from the Mac in production mode. I believe this
removes the onus from the production config; I'm not sure where to point
the finger now though.

Craig White wrote:
>> > jp
>>
>> Another clue. I just went back to the development machine and forced
>> script/server to run in production mode (script/server -e production),
>> and it still works from the Mac in production mode. I believe this
>> removes the onus from the production config; I'm not sure where to point
>> the finger now though.
> ----
> can the 'production' server actually send out traffic on port 25 (i.e.
> firewall or other routing issues?)
>
> can you telnet from the production server to the smtp server on port 25?
>
> Craig

It is not on port 25 for safety reasons.

The production server and the server with the smtp are the same box.

From the mac I can telnet to the smtp server on its proper port. From
the production server (which is also the smtp server), it gives me
connection refused. I guess this is the problem. Why didn't it give a
delivery error???

Should I use :sendmail on the production server instead? What setup
will I need to do in my Postfix to make it allow that?

Well, on my machine... I run SMTP on port 24 AND 25. Port 25 is
filtered by my home ISP, while 24 slips right through...

Port 24 is, however, hardened in the manner you stated. And if the
SMTP server and application are on the same machine, there's no reason
to change the port, just configure smtp to only listen on loopback
(127.0.0.1, and ::1, for those cool IPv6 people)

Well, on my machine... I run SMTP on port 24 AND 25. Port 25 is
filtered by my home ISP, while 24 slips right through...

Port 24 is, however, hardened in the manner you stated. And if the
SMTP server and application are on the same machine, there's no reason
to change the port, just configure smtp to only listen on loopback
(127.0.0.1, and ::1, for those cool IPv6 people)

Craig White wrote:

> jp

Another clue. I just went back to the development machine and forced
script/server to run in production mode (script/server -e production),
and it still works from the Mac in production mode. I believe this
removes the onus from the production config; I'm not sure where to point
the finger now though.

----
can the 'production' server actually send out traffic on port 25 (i.e.
firewall or other routing issues?)

can you telnet from the production server to the smtp server on port 25?

Craig

Ok, I'm at a point now where I can ssh into the server box (the box that
runs both the rails app and the smtp server) with an ordinary user
account (not root or anything special). From there I can telnet in on
port 25 and successfully send an email to a domain that is not related
to that box.

Even with that, I can find no combination of smtp settings that will
make ANY of the following happen:
1) successful email
2) delivery failure exception
3) anything at all showing up in the postfix log

It is acting exactly as it would if the delivery type was set to :test,
but it clearly isn't as seen above. The test database has not been
created yet or migrated, so I'm quite sure I'm not somehow running with
test environment. Can anybody suggest something else to look at
here???

FWIW, this is Rails 2.1, running on lighttpd proxied through apache (I
have many different things on this box, and that seems to be the
simplest way). The box is running RHEL4 OS. The mail server is
postfix. The postfix config is mostly unmollested, save the addition of
all of my domains to the "destinations" list.

thanks,
jp

Michael Graff wrote:

Well, on my machine... I run SMTP on port 24 AND 25. Port 25 is
filtered by my home ISP, while 24 slips right through...

Port 24 is, however, hardened in the manner you stated. And if the
SMTP server and application are on the same machine, there's no reason
to change the port, just configure smtp to only listen on loopback
(127.0.0.1, and ::1, for those cool IPv6 people)

Hi Michael,
The smtp server is also used for regular mail for my several other
domains, so I can't config it for ONLY local.

I'm becoming more and more certain that the problem lies before the smtp
config though, based on the fact that I've never gotten anything to show
up in the postfix log despite a dozen different configs, and also it
never gives me a delivery failure exception despite having it set for
that.

My other reply just above provides some more details about my setup.

thanks,
jp

Craig White wrote:
>> > jp
>>
>> Another clue. I just went back to the development machine and forced
>> script/server to run in production mode (script/server -e production),
>> and it still works from the Mac in production mode. I believe this
>> removes the onus from the production config; I'm not sure where to point
>> the finger now though.
> ----
> can the 'production' server actually send out traffic on port 25 (i.e.
> firewall or other routing issues?)
>
> can you telnet from the production server to the smtp server on port 25?
>
> Craig

Ok, I'm at a point now where I can ssh into the server box (the box that
runs both the rails app and the smtp server) with an ordinary user
account (not root or anything special). From there I can telnet in on
port 25 and successfully send an email to a domain that is not related
to that box.

Even with that, I can find no combination of smtp settings that will
make ANY of the following happen:
1) successful email
2) delivery failure exception
3) anything at all showing up in the postfix log

It is acting exactly as it would if the delivery type was set to :test,
but it clearly isn't as seen above. The test database has not been
created yet or migrated, so I'm quite sure I'm not somehow running with
test environment. Can anybody suggest something else to look at
here???

FWIW, this is Rails 2.1, running on lighttpd proxied through apache (I
have many different things on this box, and that seems to be the
simplest way). The box is running RHEL4 OS. The mail server is
postfix. The postfix config is mostly unmollested, save the addition of
all of my domains to the "destinations" list.

Craig White wrote:

> can the 'production' server actually send out traffic on port 25 (i.e.
to that box.
test environment. Can anybody suggest something else to look at
here???

snip

Thus if you used 'telnet localhost 25' for connecting, then you use
localhost as the 'address'. i.e

ActionMailer::Base.smtp_settings = {
  :address => "localhost",
  :port => 25,
  :domain => "www.example.com"
  #:user_name => "me@postoffice.net",
  #:password => “mypass”,
  #:authentication => :login
    }

Craig

Thanks Craig,
It is working now using your suggested reduced config above. I still
don't understand why I couldn't find any grief in any of the various log
files. Also, why no delivery failure exceptions?!?!?!?!?!? That's
just WRONG!

thanks for the help,
jp