This is my config file in /config/initializers/setup_mail.rb:
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "...something...",
:user_name => "my_gmail_name",
:password => "my_gmail_pass",
:authentication => "plain",
:enable_starttls_auto => true
}
And this is the Mailer's class with method I use:
class Notifierpass < ActionMailer::Base
default from: "no-reply@my-domain.com"
def forgot_password(user)
@reset_password_link = reset_password_url(user.perishable_token)
mail(:from => "no-reply@my-domain.com", :to => user.email, :subject => "New passwordt")
end
end
The sending emails is working, my problem is, that in the email’s field From is always my_user_name instead no-reply@my-domain.com.
Where is the problem? Why is still used my gmail name?
GMail will only let you send emails from your account, or other email addresses you have correctly configured. To send from an alternative email address you need to add it in the Gmail settings. You can only add addresses that you can already receive from.