Help for beginner / Ayuda para un principiante en CONSUL

Buenos días, necesito algo de ayuda para in principiante. Tengo una instalación de CONSUL funcionando en modo development. La instalación no la hice yo y por eso ando perdido ya que es la primera vez que trabajo con rails y consul.
Todo funciona menos los envío de email, como los de registro. Se muestra el mensaje de que se ha enviado pero nunca llega nada.
He modificado el archivo secrets.yml y lo único que consigo es que el servicio no arranque. Desde que descomento alguna de las líneas ya no arranca.
He pensado que quizás todo venga por el modo development y estoy pensando en pasarlo a producción pero no veo claro cómo hacerlo.
Sé que son muchas preguntas pero si alguien puede echarme una mano se lo agradeceré.
Saludos

Good morning, I need some help for a beginner. I have a CONSUL installation running in development mode. I didn’t do the installation and that’s why I’m lost since it’s the first time I’ve worked with rails and consul.
Everything works except sending emails, such as registration. The message that it has been sent is displayed but nothing ever arrives.
I have modified the secrets.yml file and the only thing I get is that the service does not start. Since I uncommented any of the lines it no longer starts.
I have thought that perhaps everything comes through the development mode and I am thinking of passing it to production but I am not sure how to do it.
I know there are a lot of questions but if someone can help me I would appreciate it.
Cheers

Hola Juven,

Si tienes un Consul instalado en modo desarrollo es normal que no se envíen correos.

En el fichero config/environments/development.rb puedes ver que la configuración para enviar correos se hace a través del letter_opener :

# Deliver emails to a development mailbox at /letter_opener
config.action_mailer.delivery_method = :letter_opener

Que es muy útil cuando se esta desarrollando en local poder ver que se envían los correos sin necesidad de configurar los smtp_settings .Si te fijas en los entornos de staging (config/environments/staging.rb), preproduction (config/environments/preproduction.rb) o production (config/environments/production.rb) la configuración para poder enviar correos es diferente:

  # Configure your SMTP service credentials in secrets.yml
  if Rails.application.secrets.smtp_settings
    config.action_mailer.delivery_method = Rails.application.secrets.mailer_delivery_method || :smtp
    config.action_mailer.smtp_settings = Rails.application.secrets.smtp_settings
  end

Cómo puedes ver esta configuración depende del secrets.yml.

Así que el problema que parece que tienes, es que estás modificando los secrets relacionados con el smtp_settings, pero al estar en un entorno de desarrollo no se utilizan.

Para que estando en modo desarrollo te cargue la configuración de los secrets.yml deberías cambiar del fichero config/environments/development.rb las siguientes lineas:

--  # Deliver emails to a development mailbox at /letter_opener
--  config.action_mailer.delivery_method = :letter_opener

++  # Configure your SMTP service credentials in secrets.yml
++  if Rails.application.secrets.smtp_settings
++    config.action_mailer.delivery_method = Rails.application.secrets.mailer_delivery_method || :smtp
++    config.action_mailer.smtp_settings = Rails.application.secrets.smtp_settings
++  end

y configurar correctamente en el apartado de development del secrets.yml los siguientes secretos:

  # mailer_delivery_method: :smtp
  # smtp_settings:
  #   :address: "smtp.example.com"
  #   :port: 25
  #   :domain: "your_domain.com"
  #   :user_name: "<username>"
  #   :password: "<password>"
  #   :authentication: "plain"
  #   :enable_starttls_auto: true

Espero que este comentario te sea de utilidad.

Saludos.

#############################################################

Hi Juven,

If you have a Consul installed in development mode it is normal that the emails are not sent.

In the config/environments/development.rb file you can see that the configuration to send emails is done through the letter_opener:

# Deliver emails to a development mailbox at /letter_opener
config.action_mailer.delivery_method = :letter_opener

Which is very useful when developing locally to be able to see emails being sent without having to configure the smtp_settings.

If you look at the staging(config/environments/staging.rb), preproduction(config/environments/preproduction.rb) or production(config/environments/production.rb) environments the configuration for sending mail is different:

  # Configure your SMTP service credentials in secrets.yml
  if Rails.application.secrets.smtp_settings
    config.action_mailer.delivery_method = Rails.application.secrets.mailer_delivery_method || :smtp
    config.action_mailer.smtp_settings = Rails.application.secrets.smtp_settings
  end

As you can see this configuration depends on the secrets.yml.

So the problem you seem to have is that you are modifying the secrets related to the smtp_settings, but being in a development environment they are not being used.

If you want to get the secrets.yml settings in development mode you should change the following lines in config/environments/development.rb:

--  # Deliver emails to a development mailbox at /letter_opener
--  config.action_mailer.delivery_method = :letter_opener

++  # Configure your SMTP service credentials in secrets.yml
++  if Rails.application.secrets.smtp_settings
++    config.action_mailer.delivery_method = Rails.application.secrets.mailer_delivery_method || :smtp
++    config.action_mailer.smtp_settings = Rails.application.secrets.smtp_settings
++  end

and configure correctly in the development section of the secrets.yml the following secrets:

  # mailer_delivery_method: :smtp
  # smtp_settings:
  #   :address: "smtp.example.com"
  #   :port: 25
  #   :domain: "your_domain.com"
  #   :user_name: "<username>"
  #   :password: "<password>"
  #   :authentication: "plain"
  #   :enable_starttls_auto: true

I hope this comment is helpful to you.

Best regards.