我正在编写一个脚本,该脚本会将电子邮件发送给人员列表,并且通过此电子邮件将会有一个附件。
我一直在讨论这个问题:
/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
}
)
有什么可能出错的想法吗?
答案 0 :(得分:4)
这告诉您发送给它的邮箱空间不足。
错误是SMTP错误: 552请求的邮件操作已中止:超出存储分配
在rfc http://www.ietf.org/rfc/rfc2821.txt中列出。
因此,邮箱已满或您发送的内容不适合
答案 1 :(得分:1)
请使用此
:attachments => {File.basename("#{attachment}") => File.read("#{attachment}")},
:headers => { "Content-Type" => "multipart/mixed", "Content-Transfer-Encoding" => "base64", "Content-Disposition" => "attachment" }
这可能会解决您的问题。