Ich habe eine Rails App auf Heroku, die E-Mails senden kann. Ich habe eine neue Funktion hinzugefügt, um E-Mails für eine Benachrichtigung zu senden. Ich bekomme das in Heroku-Logs, aber keine E-Mails werden gesendet. DieseWarum wird meine E-Mail nicht in meiner Ruby on Rails 5 App bereitgestellt?
2016-07-29T19:57:58.895499+00:00 app[web.1]: [ActiveJob] [NotificationBroadcastJob] [40c7b651-3c5d-4308-b8b5-49a142d2930f] Rendered notifications_mailer/new_message.html.erb (226.4ms)
2016-07-29T19:57:58.895630+00:00 app[web.1]: [ActiveJob] [NotificationBroadcastJob] [40c7b651-3c5d-4308-b8b5-49a142d2930f] NotificationsMailer#new_message: processed outbound mail in 246.0ms
2016-07-29T19:57:58.895741+00:00 app[web.1]: [ActiveJob] [NotificationBroadcastJob] [40c7b651-3c5d-4308-b8b5-49a142d2930f] Performed NotificationBroadcastJob from Async(default) in 377.85ms
ist notifications_mailer Rubin Datei app/Mailer/notifications_mailer.rb
class NotificationsMailer < ApplicationMailer
def new_message(message)
@message = message
mail(to: message.receiver.email, subject: 'You have a new message')
end
end
Dies ist, wie ich nenne die new_message Aktion in app/Jobs/notifications_broadcast_job.rb
class NotificationBroadcastJob < ApplicationJob
.
.
NotificationsMailer.new_message(personal_message).deliver_now
I Verwenden Sie das Sendgrid-Addon und das ist von production.rb
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
host = 'www.abcdef.com'
config.action_mailer.default_url_options = { host: host }
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'www.abcdef.com',
:enable_starttls_auto => true
}
Das ist mein development.rb
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :test
host = 'rails-tutorial-suai.c9.io'
config.action_mailer.default_url_options = { host: host }
config.action_mailer.perform_caching = false
Ich habe keine Arbeiter dynos. Das ist meine Procfile.
web: bundle exec puma -C config/puma.rb
Kann jemand bitte helfen? Danke
Haben Sie sendgrid oder einen anderen E-Mail-Dienst konfiguriert? –
@SergioTulentsev Ja. Ich habe die Fragen mit diesen Einstellungen aktualisiert. – LovingRails
Haben Sie einen Arbeiter-Dynaset? Was ist in deinem Prozess? – M00B