2

我正在编写一个脚本,它将向人员列表发送电子邮件,并且这封电子邮件将有一个附件。

我一直遇到这个问题:
/usr/local/lib/ruby/1.9.1/net/smtp.rb:942:in 'check_response': 552 sorry, that message size exceeds my databytes limit (#5.3.4) (Net::SMTPFatalError)

附件只有110kb

代码:

    Pony.mail(
        :to => to,
        :from => 'Me <me@me.com>',
        :subject => html_entity_decoder.decode(options[:subject]),
        :html_body => "#{options[:body]}".html_safe,
        :attachments => {File.basename("#{attachment}") => File.read("#{attachment}")},
        :headers => { "Content-Type" => "multipart/mixed", "Content-Transfer-Encoding" => "base64", "Content-Disposition" => "attachment" },
        :via => :smtp, 
        :via_options => {
          :address        => ADDRESS,
          :port           => '25',
          :enable_starttls_auto => true,
          :user_name      => USERNAME,
          :password       => PWD,
          :authentication => :plain,
          :domain         => DOMAIN
          }
      )

知道什么可能是错的吗?

4

2 回答 2

4

这告诉您要发送到的邮箱空间已用完。

错误是 SMTP 错误:552 Requested mail action aborted: exceeded storage allocation

rfc http://www.ietf.org/rfc/rfc2821.txt中概述。

因此,要么邮箱已满,要么您发送的东西不适合它

于 2011-03-01T22:23:45.920 回答
1

请使用这个

:attachments => {File.basename("#{attachment}") => File.read("#{attachment}")},
  :headers => { "Content-Type" => "multipart/mixed", "Content-Transfer-Encoding" => "base64", "Content-Disposition" => "attachment" }

可能这会解决你的问题。

于 2014-01-02T18:15:15.973 回答