Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the possibility to send mails over SMTP #275

Closed
gabauer opened this issue Feb 18, 2021 · 4 comments · Fixed by #276
Closed

Adding the possibility to send mails over SMTP #275

gabauer opened this issue Feb 18, 2021 · 4 comments · Fixed by #276

Comments

@gabauer
Copy link
Contributor

gabauer commented Feb 18, 2021

name about title labels assignees
Feature request Suggest to add the possibility to also use SMTP for sending mails Adding the possibility to send mails over SMTP

Is your feature request related to a problem? Please describe.

I want to host Quepid for a company for this it is necessary for me that the password reset button is working and can send mails over my own SMTP server. I want to add this functionality and extend the documentation.

Describe the solution you'd like

Because I'm new to ruby and rails, I don't know if this is the best solution, but I wanted to add a smtp_mail_provider.rb to the initializers folder where if a env var (MAIL_METHOD) is present and equals "smtp" the Rails.application.config.action_mailer.delivery_method is set to SMTP and the server details are read from the following env vars:

  • SMTP_HOST
  • SMTP_PORT
  • SMTP_USERNAME
  • SMTP_PASSWORD
  • SMTP_AUTHENTICATION_TYPE
  • SMTP_ENABLE_STARTTL

Describe alternatives you've considered

An alternative would be to place the code which sets action_mailer.delivery_method to SMTP in the application.rb or in an environment file under environments/.

  • I decided not to use the environment files for this because the code would need to be repeated for test, development, staging, and production.
  • I decided not to use the config/application.rb, because I think there should be only defined the standard delivery_method (postmark)

Additional context

If it is okay, I would like to take over this ticket.

@epugh
Copy link
Member

epugh commented Feb 18, 2021

I'd love to see this! Thanks for sharing your thinking in the issue, this is a nicely written up example!

I think your approach of an initializer makes sense, and setting values based on my reading of https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration.

I expected to find our mailers in /app/mailers, and didn't, which reminded me that we use Devise for user auth, and those emails are sent by Devise. Not sure that matters for waht you are trying!

@gabauer
Copy link
Contributor Author

gabauer commented Feb 18, 2021

Thanks for the fast reply! I did the changes regarding this ticket in a local branch, but I can't push the branch to GitHub so that I can open a pull request.

@epugh can you help me with the process of getting permissions to do that?

@gabauer
Copy link
Contributor Author

gabauer commented Feb 19, 2021

@epugh please ignore my stupid question. I found out that the normal process is forking and then opening an pull request. Will do this today.

@epugh
Copy link
Member

epugh commented Feb 19, 2021

There are no stupid questions! I am super excited about your PR.

epugh pushed a commit that referenced this issue Feb 22, 2021
…ng documentation (#275) (#276)

* Added functionality to send mails over smtp and start with an operating documentation

* Refactoring a bit...

The customize_quepid class is where we expect to find all customozations possible, so I moved the check to there.   I wanted a more generic handling of emails, so rename smtp_mail_provider to email_provider, That led to moving some more of the email settings stuff there.    Tweak the docs!

Co-authored-by: [email protected] <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants