发送邮件时指定名称的问题

时间:2011-05-12 19:29:31

标签: ruby-on-rails-3 email postfix-mta

我的代码: -

from = @site.name + ", <no-reply@" + @site.url + ">"
mail(:from => from , :to => @recipient.email, :subject => "Invitation mail") 

错误是: -

 Net::SMTPSyntaxError (501 5.1.7 Bad sender address syntax 
):

1 个答案:

答案 0 :(得分:2)

删除@site.name<括号之间的逗号。你正试图这样做:

My Name, <no-reply@mysite.com>

应该是:

My Name <no-reply@mysite.com>