Mailer - from address not being set


#1

I’m having a weird problem with a mailer model. The from address
doesn’t seem to be set - my mail logs it shows that the sender address
is the default removed_email_address@domain.invalid and this causes the mail to
bounce.

The mailer code looks like this:

def thismail
@subject = “Subject”
@recipients = “removed_email_address@domain.invalid”
@from = “removed_email_address@domain.invalid”

rest of code

end

The weird thing is, the development log shows the correct details…

Sent mail:
From: removed_email_address@domain.invalid
To: removed_email_address@domain.invalid

Anyone come across this problem before? I guess it could be the
server’s mail setup but i thought i’d check just in case it’s something
obvious/known :0)

Cheers,

Steve


#2

Sorted. Entirely my stupidity.

Quick explaination:

The server wasn’t complaining about the from address - it was
complaining about the fact that the server didn’t have a reverse mapping
on the hostname it provided.

I didn’t notice this at first because ActionMailer was suppressing any
errors it received from the smtp server. Once i realised that the
environments/development.rb overrides environments.rb (duh!), i made
active mailer raise mail errors. That gave me a nice error message. I
then set up a reverse dns lookup for my dev server (something i should
have done ages ago) and all worked :0)

Steve

Stephen B. wrote:

I’m having a weird problem with a mailer model. The from address
doesn’t seem to be set - my mail logs it shows that the sender address
is the default removed_email_address@domain.invalid and this causes the mail to
bounce.

The mailer code looks like this:

def thismail
@subject = “Subject”
@recipients = “removed_email_address@domain.invalid”
@from = “removed_email_address@domain.invalid”

rest of code

end

The weird thing is, the development log shows the correct details…

Sent mail:
From: removed_email_address@domain.invalid
To: removed_email_address@domain.invalid

Anyone come across this problem before? I guess it could be the
server’s mail setup but i thought i’d check just in case it’s something
obvious/known :0)

Cheers,

Steve