0

this is my first time using ActionMailer. I have a hard time set the sender email. This is my development.rb :

config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: 'smtp.gmail.com', port: 587, user_name: 'foo', password: 'mypass', authentication: 'plain', enable_starttls_auto: true } config.action_mailer.raise_delivery_errors = true config.action_mailer.perform_deliveries = true 

And this is my feedback_mailer.rb :

class FeedbackMailer < ActionMailer::Base def feedback_email(feedback, setting_configuration) @feedback = feedback @setting_configuration = setting_configuration mail(to: @setting_configuration.value, :from => feedback.email, subject: @feedback.inquiry_type ) end end 

But the sender email is still [email protected]. Can I set the sender's email using smtp? Or I have to use sendmail? I tried using :sendmail, instead of smtp, but I have this error :

Errno::ENOENT - No such file or directory - /usr/sbin/sendmail -i -t -f 

What should I set in the sendmail? I tried googled it and everything, but nothing worked. Would be really glad, if anyone could help. Thanks

1 Answer 1

1

What you have looks correct. The "from" argument in the call to mail should set the email address that is on the email. We're using Sendgrid on Heroku and it works. This makes me suspect that maybe Google is replacing it with the account holder's email address. Perhaps test it using another email service and see if you have better luck.

Sign up to request clarification or add additional context in comments.

2 Comments

I couldn't find anything to confirm this on Google's site, but I did find this stackoverflow.com/questions/5784936/actionmailer-from-setting. It seems Google does, in fact, ignore the from field. If you are using Heroku, Sendgrid is easy to set up and the free version might be all you need. Good luck.
yes, you are right. Google replacing the from field. thanks, man! I am considering using Sendgrid now

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.