我正在编写一个通过有效的GMail用户ID和密码发送邮件的应用程序.
我只是想在我的Windows XP命令行上模拟SMTP连接,当我smtp.gmail.com在465端口telnet 时 - 我没有看到任何东西.带有标题的空白命令窗口Telnet smtp.gmail.com随光标打开.当我输入EHLO或通常的SMTP握手命令时,提示只是关闭.
我无法弄清楚什么是错的,在哪里.我尝试连接到587,它根本没有连接到telnet.任何人都可以澄清我是否做错了什么?
我正在使用actionmailer向用户发送设计的注册验证详细信息,但我收到以下错误:
用户中的Net :: OpenTimeout :: RegistrationsController #create
我的development.rb看起来像:
config.action_mailer.default_url_options = { :host => 'http://localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 25,
:domain => 'gmail.com',
:user_name => 'example@gmail.com',
:password => 'secret',
:authentication => 'plain',
:enable_starttls_auto => true,
:ssl => true
}
Run Code Online (Sandbox Code Playgroud)
我使用这个问题并补充说
#disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Run Code Online (Sandbox Code Playgroud)
命令:
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
Run Code Online (Sandbox Code Playgroud)
返回1.它对我的错误没有影响.还尝试将端口从587更改为2525.所以我尝试从命令行建立与服务器的连接:
telnet smtp.gmail.com 2525
Run Code Online (Sandbox Code Playgroud)
拿到:
Trying 74.125.68.108...
Trying 74.125.68.109...
Trying 2404:6800:4003:c02::6c...
telnet: Unable to connect to remote …Run Code Online (Sandbox Code Playgroud) 尝试从Ruby on Rails发送电子邮件,但得到这个:
SocketError in UsersController#create
getaddrinfo: nodename nor servname provided, or not known
Run Code Online (Sandbox Code Playgroud)
我的environment/development.rb文件有:
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "my_company.org",
authentication: "plain",
enable_starttls_auto: true,
user_name: "my_username@my_company.org",
password: "my_pass"
}
Run Code Online (Sandbox Code Playgroud)
和
config.action_mailer.delivery_method = :smtp
Run Code Online (Sandbox Code Playgroud)
和
config.action_mailer.default_url_options = { :host => 'localhost:5000' }
# 5000 rather than 3000 as I am using foreman.
Run Code Online (Sandbox Code Playgroud)