I am fighting with setting up the "from" information that is shown in the email in header.
It still shows incorrect email address. In the mailer class, I manually set the default email address:
class NotificationMailer < ActionMailer::Base
default content_type: "text/html", :from => 'default@email.com'
I also specified this in the method for sending the email(s):
def welcome_email(user)
@user = user
mail(to: @user.email, subject: "Welcome!", from: 'default@email.com')
end
But when I receive this email, it's from my-personal-email@gmail.com
. I searched through the Rails app where is this email address set up and it's here:
config/initializers/setup_email.rb
:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "logistadvise.com",
:user_name => "my-personal-email@gmail.com",
:password => "mypassword",
:authentication => "plain",
:enable_starttls_auto => true
}
Emails are sent out well, but worries me that I am unable to properly set the "from" header.
How to do that?
Thank you.