A
A
Anton Misyagin2015-04-08 17:30:47
Ruby on Rails
Anton Misyagin, 2015-04-08 17:30:47

How to bypass the certificate error on yandex when sending a letter on Rails?

The second approach to sending emails from a Rails application. The first ended in failure six months ago.
smtp, yandex...
config/environments.rb:
config.action_mailer.raise_delivery_errors = true
This allowed to display error messages about sending emails to the browser

ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => true,
    address:"smtp.yandex.ru",
    port: 587,
    domain: "127.0.0.1",
    authentication: "plain",
    user_name: "[email protected]",
    password: "неверный пароль"
}

535 5.7.8 Error: authentication failed: Invalid user or password!

It intelligibly answers that the password is incorrect
. We give the correct password:
ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => true,
    address:"smtp.yandex.ru",
    port: 587,
    domain: "127.0.0.1",
    authentication: "plain",
    user_name: "[email protected]",
    password: "верный пароль"
}

554 5.7.1 Message rejected under suspicion of SPAM

He sees the letter, thinks it's spam
. Maybe it's because of TLS. We try to play with the parameters:
config/initializers/mail.rb:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => false,
    :tls => false,
    address:"smtp.yandex.ru",
    port: 587,
    domain: "127.0.0.1",
    authentication: "plain",
    user_name: "[email protected]",
    password: "верный пароль"
}

530 5.7.7 Email sending without SSL/TLS encryption is not allowed. Please see: help.yandex.ru/mail/mail-clients/ssl.xml

Without TLS does not want to communicate at all
config/initializers/mail.rb:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => false,
    :tls => true,
    address:"smtp.yandex.ru",
    port: 587,
    domain: "127.0.0.1",
    authentication: "plain",
    user_name: "[email protected]",
    password: "верный пароль"
}

or:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => true,
    :tls => true,
    address:"smtp.yandex.ru",
    port: 587,
    domain: "127.0.0.1",
    authentication: "plain",
    user_name: "[email protected]",
    password: "верный пароль"
}

SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

Then I tried to read and do as it is written here: https://gist.github.com/fnichol/867550.
All the same.
I thought that perhaps the mailbox itself needs to be configured in some way. No:
Tried Mozilla Tundrabird - it works well. Those. with mail as such - everything is in order.
But people succeed, for example, Renat Ibragimov: vk.com/topic-31022447_30379827
What to do? Who made it?
As I was writing this post, I figured it out myself:
ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => true,
    # :openssl_verify_mode => 'none',
    # :tls => true,
    address:"smtp.yandex.ru",
    port: 587,
    domain: "127.0.0.1:3000",
    authentication: "plain",
    user_name: "[email protected]",
    password: "верный пароль"
}

The letter finally arrived.
It was necessary to register the port!
Decided to post anyway. Maybe someone will come in handy)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Misyagin, 2015-04-09
@sunnmas

ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
address:"smtp.yandex.ru",
port: 587,
domain: "127.0.0.1:3000",
authentication: "plain",
user_name: "[email protected]",
password: "верный пароль"
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question