Ruby on rails电子邮件错误535-5.7.1用户名和密码不被接受。

时间:2022-10-16 14:44:06

I am getting error when I try to send an e-mail. I am trying to send email from localhost.. the actionmailer setting are

当我试图发送电子邮件时,我正在出错。我正在尝试从本地主机发送电子邮件。邮件设置是

ActionMailer::Base.smtp_settings = {

 :enable_starttls_auto => true,

 :address => "smtp.gmail.com",

 :port => 587,

 :domain => "mydomain.com",

 :authentication => :plain,

 :user_name => "do-not-reply@mydomain.com",

  :password => "mypassword"

 }

When I configured it first time the email was working fine. but after sending 4 or 5 email the functionality stopped working and shows me this error

当我第一次配置它时,电子邮件运行良好。但在发送了4或5封电子邮件后,这个功能停止了工作,并向我显示了这个错误

Net::SMTPAuthenticationError ............

Net::SMTPAuthenticationError ............

535-5.7.1 Username and Password not accepted.

535-5.7.1用户名和密码不接受。

Where could be a problem?

哪里会有问题呢?

Thanks..

谢谢. .

4 个解决方案

#1


2  

I was trying to send using smtp from a ruby application on my hosted webserver, and was getting denied, something Gmail does a security precaution.

我试图使用smtp从托管的webserver上的ruby应用程序发送,但遭到拒绝,Gmail做了安全防范。

The solution was first to login to gmail in my own browser on my laptop, as usual. There was an alert at the top saying gmail had detected suspicious activity. "Was it you?" I clicked through a few steps saying it was me and was brought to a screen that said:

解决方案是,像往常一样,首先在我的笔记本电脑上用自己的浏览器登录gmail。顶部有一个警报说gmail检测到可疑活动。“是你?”我点击了几个步骤,说那是我,然后屏幕上显示:

Next step

Sign in using the application you want to authorize access to your account within the next ten minutes. Google will remember the application after it signs in, and will allow it to access your account in the future as long as it uses the correct password.

在接下来的十分钟内,使用你想授权的应用程序登录你的帐户。谷歌登录后会记住应用程序,并允许它在未来访问您的帐户,只要它使用正确的密码。

I then ssh'd into my server, and from the command line did:

然后ssh进入我的服务器,从命令行开始:

lynx http://mail.google.com/mail/?ui=html

I then logged into gmail using lynx, and the problem was solved.

然后我使用lynx登录gmail,问题就解决了。

#2


0  

I had the same problem and when I double-checked the password I realized that I had typed it in wrong.

我也有同样的问题,当我再次检查密码时,我意识到我输入错误了。

So, the error can be generated by a bad password and presumably a bad username as well. After you correct the username and password make sure you restart your rails application.

因此,错误可以由坏密码和坏用户名生成。修改用户名和密码后,请确保重新启动rails应用程序。

I also presume that you aren't actually using the literal text "mydomain.com", right?

我还假设你没有使用字面文本mydomain.com,对吧?

#3


0  

If you're sure you've checked your settings many times and still get:

如果你确定你检查了很多次你的设置,仍然得到:

535-5.7.8 Username and Password not accepted

Try restarting your rails server especially when you've changed your yaml file or environment files.

尝试重新启动rails服务器,特别是当您更改了yaml文件或环境文件时。

rails s

See When do I need to restart server in Rails? for more information on when and why you should restart.

看到什么时候需要在Rails中重新启动服务器了吗?有关何时和为什么应该重新启动的更多信息。

#4


0  

Goto config/initializers/setup_mail.rb Check whether the configuration there matches the configuration written in the development.rb file.It should look like the following in both files:

转到配置/初始化/ setup_mail。rb检查那里的配置是否与开发中编写的配置匹配。rb文件。两个文件应该如下所示:

config.action_mailer.smtp_settings = {
     :address =>"smtp.gmabirdvision17@gmail.comil.com",
     :port => 587,
     :domain => "gmail.com",
     :user_name => "mygmail@gmail.com",
     :password => "**********",
     :authentication => 'plain',
     :enable_starttls_auto => true,
     :openssl_verify_mode => 'none' 
     }  

This will most certainly solve your problem.

这肯定能解决你的问题。

#1


2  

I was trying to send using smtp from a ruby application on my hosted webserver, and was getting denied, something Gmail does a security precaution.

我试图使用smtp从托管的webserver上的ruby应用程序发送,但遭到拒绝,Gmail做了安全防范。

The solution was first to login to gmail in my own browser on my laptop, as usual. There was an alert at the top saying gmail had detected suspicious activity. "Was it you?" I clicked through a few steps saying it was me and was brought to a screen that said:

解决方案是,像往常一样,首先在我的笔记本电脑上用自己的浏览器登录gmail。顶部有一个警报说gmail检测到可疑活动。“是你?”我点击了几个步骤,说那是我,然后屏幕上显示:

Next step

Sign in using the application you want to authorize access to your account within the next ten minutes. Google will remember the application after it signs in, and will allow it to access your account in the future as long as it uses the correct password.

在接下来的十分钟内,使用你想授权的应用程序登录你的帐户。谷歌登录后会记住应用程序,并允许它在未来访问您的帐户,只要它使用正确的密码。

I then ssh'd into my server, and from the command line did:

然后ssh进入我的服务器,从命令行开始:

lynx http://mail.google.com/mail/?ui=html

I then logged into gmail using lynx, and the problem was solved.

然后我使用lynx登录gmail,问题就解决了。

#2


0  

I had the same problem and when I double-checked the password I realized that I had typed it in wrong.

我也有同样的问题,当我再次检查密码时,我意识到我输入错误了。

So, the error can be generated by a bad password and presumably a bad username as well. After you correct the username and password make sure you restart your rails application.

因此,错误可以由坏密码和坏用户名生成。修改用户名和密码后,请确保重新启动rails应用程序。

I also presume that you aren't actually using the literal text "mydomain.com", right?

我还假设你没有使用字面文本mydomain.com,对吧?

#3


0  

If you're sure you've checked your settings many times and still get:

如果你确定你检查了很多次你的设置,仍然得到:

535-5.7.8 Username and Password not accepted

Try restarting your rails server especially when you've changed your yaml file or environment files.

尝试重新启动rails服务器,特别是当您更改了yaml文件或环境文件时。

rails s

See When do I need to restart server in Rails? for more information on when and why you should restart.

看到什么时候需要在Rails中重新启动服务器了吗?有关何时和为什么应该重新启动的更多信息。

#4


0  

Goto config/initializers/setup_mail.rb Check whether the configuration there matches the configuration written in the development.rb file.It should look like the following in both files:

转到配置/初始化/ setup_mail。rb检查那里的配置是否与开发中编写的配置匹配。rb文件。两个文件应该如下所示:

config.action_mailer.smtp_settings = {
     :address =>"smtp.gmabirdvision17@gmail.comil.com",
     :port => 587,
     :domain => "gmail.com",
     :user_name => "mygmail@gmail.com",
     :password => "**********",
     :authentication => 'plain',
     :enable_starttls_auto => true,
     :openssl_verify_mode => 'none' 
     }  

This will most certainly solve your problem.

这肯定能解决你的问题。