邮件宝石错误,字符“&”在电子邮件的本地部分

时间:2015-05-04 18:10:36

标签: ruby-on-rails-4 character-encoding actionmailer

我的系统现在已经正确地发送了很长时间的电子邮件,但昨天我插入了电子邮件550 restricted characters in address /home/solvis/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/smtp.rb:957:in `check_response' /home/solvis/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/smtp.rb:926:in `getok' /home/solvis/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/smtp.rb:869:in `rcptto' /home/solvis/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/smtp.rb:850:in `block in rcptto_list' /home/solvis/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/smtp.rb:848:in `each' /home/solvis/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/smtp.rb:848:in `rcptto_list' /home/solvis/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/smtp.rb:663:in `send_message' /home/solvis/rails-deploy/server/shared/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:113:in `block in deliver!' /home/solvis/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/net/smtp.rb:521:in `start' /home/solvis/rails-deploy/server/shared/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!' /home/solvis/rails-deploy/server/shared/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:2141:in `do_delivery' /home/solvis/rails-deploy/server/shared/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:236:in `block in deliver' /home/solvis/rails-deploy/server/shared/bundle/ruby/2.1.0/gems/actionmailer-4.1.7/lib/action_mailer/base.rb:527:in `block in deliver_mail' ... (fakedomain是一个虚假的域名,用于隐私),导致以下错误:

<application
    ...
    android:theme="@android:style/Theme.NoTitleBar" >
</application>

字符&amp; 和邮件gem可能存在问题。这可能是一些编码问题,但我找不到解决方案。

视频:根据this reference,电子邮件本地部分的&amp; 有效。电子邮件本身有效。

编辑:

我尝试直接从我的邮件服务器发送邮件,并通过“&amp;”正确地发送到电子邮件当地的角色。它可能是邮件gem的非us-ascii字符的自动编码。任何提示?

1 个答案:

答案 0 :(得分:2)

此错误来自SMTP服务器,而不是来自Mail gem或Action Mailer。 550 is the error code。这通常意味着收件人的邮件服务器说邮箱不存在,但在这种情况下,它拒绝该地址,因为它不喜欢该字符。

虽然电子邮件地址通常允许&,但电子邮件服务器可以将电子邮件地址限制为他们想要的任何字符。