Errno :: ECONNREFUSED: Odrzucono połączenie - connect (2) dla mailera akcji
Od dłuższego czasu pracuję z szynami. Teraz mam do czynienia z małym problemem w ActionMailer. Chcę wysłać wiadomość e-mail, gdy użytkownik zostanie zarejestrowany, aby potwierdzić swoją rejestrację. Jestem w stanie wysłać e-mail wTryb rozwoju ale gdzie taknie wtryb produkcji.
wyjątekErrno :: ECONNREFUSED: Odrzucono połączenie - połącz (2) nadchodzi za każdym razem, kiedydostarczyć metoda jest nazywana.
Napisałem następujący kod.
Wygląd mojej konfiguracji SMTP:
config.action_mailer.default_url_options = {: host => "localhost: 3000"}
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:openssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,
:ssl => true,
:enable_starttls_auto => true, #this is the important stuff!
:address => 'smtp.xxxx.xxx',
:port => xxx,
:domain => 'xxxxxx',
:authentication => :plain,
:user_name => '[email protected]',
:password => 'xxxxxxxxx'
}
W kontrolerze napisałem:
def confirm_registration_in_c
@user = User.find_by_email([email protected])
if @user
UserMailer.confirm_registration(@user).deliver
end
end
W moim user_mailer.rb:
class UserMailer < ActionMailer::Base
default from: "[email protected]"
def confirm_registration(user)
@user = user
@user_name = @user.name
email = @user.email
mail(:to => email, :subject => "Reset your password")
end
end
Jestem w stanie wysłać e-mail w trybie rozwoju na moim lokalnym hoście, ale nie mogę wysłać e-maila na dedykowanym serwerze.
Czy ktoś może mi pomóc proszę?