ruby on rails - Invitation email doesn't have a From: value -
when invite user, email inviation link gets sent successfully. however, email has no from:
value, mail server returns error because (rightfully) refuses send email without from
value.
so need set value somewhere, don't know , how? both devise
, devise_invitable
not create usermailer
or invitationmailer
object. invite
method:
def invite user = user.find(params[:user_id]) user.update_attributes(invitation_created_at: datetime.now) user.deliver_invitation redirect_to users_path, notice: i18n.t("user.messages.invited") end
how can make sure from
value gets filled?
for devise add email address config/initializers/devise.rb
config.mailer_sender = 'me <noreply@me.com>'
for actionmailer add config environment config file, e.g. config/environments/production.rb
actionmailer::base.default :from => 'me <noreply@me.com>'
you can overwrite these on per mailer basis:
class examplemailer < actionmailer::base default from: "me <ceo@me.com>"
Comments
Post a Comment