Pony yandex.ru和Mail.ru详细说明 [英] Pony yandex.ru and mail.ru specifics
本文介绍了Pony yandex.ru和Mail.ru详细说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Sinatra中创建了一个表单,该表单将使用Pony gem在提交时将数据发送到电子邮件。这是我到目前为止的代码:
post '/pemco' do
Pony.mail(
:from => params[:name] + "<" + params[:email] + ">",
:to => '___@yandex.ru',
:subject => params[:name] + " has contacted you",
:body => params[:message],
:via => :smtp,
:via_options => {
:address => 'smtp.yandex.ru',
:port => '465',
:enable_starttls_auto => true,
:user_name => '___',
:password => '___',
:authentication => :plain
})
redirect '/'
end
我按提交,响应暂停一段时间,然后我得到Net::ReadTimeout 文件:协议.rb位置:Rbuf_Fill行中的救援:158错误。我做错了什么?
推荐答案
此代码适用于yandex.ru(您需要转到此处https://mail.yandex.ru/neo2/#setup/client并允许所有内容):
post '/sent' do
Pony.mail(
:to => "_yourEmail_@yandex.ru",
:from => "_sameYourEmail_@yandex.ru",
:via => :smtp,
:via_options => {
:address => 'smtp.yandex.ru',
:port => '25',
:enable_starttls_auto => true,
:user_name => '_yourUsername_',
:password => '_yourPassword_',
:authentication => :plain
})
end
相同的代码适用于Mail.ru(通常您不需要执行任何其他操作)。
这篇关于Pony yandex.ru和Mail.ru详细说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文