我的rails应用程序使用俄罗斯的.рф域名,在那里我有邮件,在那里我有默认的.
就像这样:
default from: "noreply@портал.рф"邮递员的某些部分:
class CarMailer < ActionMailer::Base
default from: "noreply@портал.рф"
def send_car_question_back(question_text, question_email, question_phone, car_user, car)
****
mail(to: @question_email, subject: "***")
end
end但是在我的邮箱里,我没有回复@blablabla,上面有一些strane号码(比如垃圾邮件:)
是否有任何方式发送邮件,并把发送者的西兰地格式?
在忏悔中我有:
config.action_mailer.smtp_settings = {
:enable_starttls_auto => false,
:address => 'localhost',
:port => 25,
:domain => 'xn----7s454545*****i',
:authentication => :login,
:content_type => "text/html",
:user_name => 'noreply@xn----7s454545*****i',
:password => '*****'
}
config.action_mailer.default_url_options = { :host => 'xn----7s454545*****i' }发布于 2014-04-30 10:59:50
该'xn----7s454545*****i'是西里尔域的正常域编码,确切地说是非ASCII域.域名转换方法用RFC 3490描述。
您的邮箱只是不支持非ASCII域转换。因此,您只需尝试将mailer设置中的域名设置为cyrillic域名,并使用IDNA转换宝石将其转换为ASCII表单:
和环境配置:
config.action_mailer.smtp_settings = {
#...
:domain => IDN::Idna.toASCII('портал.рф')
}反之亦然:
puts 'Idna.toUnicode: ' + IDN::Idna.toUnicode('xn--rksmrgs-5wao1o.josefsson.org')https://stackoverflow.com/questions/23385694
复制相似问题