J'essaie d'envoyer un courriel via amazon SES dans l'application Rails.Comment envoyer un courriel via amazon SES dans l'application Rails
Cette histoire de l'utilisateur est
Voici mon code.
config/environnements/development.rb
Rails.application.configure do
...
# deviseの設定
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'email-smtp.us-east-1.amazonaws.com',
port: 587,
authentication: :login,
user_name: '[SES UserName]',
password: '[SEP Password]',
enable_starttls_auto: true
}
end
app/mailer (Voici seulement application_mailer.rb)
class ApplicationMailer < ActionMailer::Base
default from: "[email protected]"
layout "mailer"
end
log/development.log
Started POST "https://stackoverflow.com/users/password" for 172.18.0.1 at 2017-09-27 02:55:35 +0000
...
<p>Hello [email protected]!</p>
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p><a href="http://localhost:3000/users/password/edit?reset_password_token=EoGaE1UF2KjTNFLGHhvQ">Change my password</a></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
Completed 500 Internal Server Error in 6247ms (ActiveRecord: 4.1ms)
Net::SMTPFatalError (553 <localhost:3000> Invalid email address.
):
/usr/local/lib/ruby/2.4.0/net/smtp.rb:969:in `check_response'
/usr/local/lib/ruby/2.4.0/net/smtp.rb:937:in `getok'
/usr/local/lib/ruby/2.4.0/net/smtp.rb:837:in `mailfrom'
/usr/local/lib/ruby/2.4.0/net/smtp.rb:658:in `send_message'
mail (2.6.6) lib/mail/network/delivery_methods/smtp.rb:112:in `block in deliver!'
...
puma (3.9.1) lib/puma/server.rb:435:in `process_client'
puma (3.9.1) lib/puma/server.rb:299:in `block in run'
puma (3.9.1) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
Completed 500 Internal Server Error in 84ms (Views: 73.1ms | ActiveRecord: 0.0ms)
I pense que le centre du problème est celui-ci.
Net::SMTPFatalError (553 <localhost:3000> Invalid email address.):
Mais je ne peux pas résoudre ce problème.
Comment le réparer?
Avez-vous demandé à Amazon de sortir votre SES du mode Sandbox ou essayez-vous d'envoyer un e-mail à un SES en utilisant les confirmations précédentes? – Ashan
Merci! Mon SES est maintenant hors du mode Sandbox et j'essayais d'envoyer des courriels en utilisant le courriel en blanc. –
Est-ce que ça marche maintenant? – Ashan