[fixes #55185308] Set port dynamically for default_url_options, update

Minor change to this commit.  The previous implementation crashed the
console `uninitialized constant Rails::Server (NameError)`.  This uses
a ternary operator to set the value of action_mailer's
default_url_options[:port].