Forum: Ruby on Rails mailer - from address not being set

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Stephen B. (Guest)
on 2006-06-01 00:33
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
Stephen B. (Guest)
on 2006-06-01 01:19
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
This topic is locked and can not be replied to.