使用 Pony Gem 在 Ruby 中发送带有附件的电子邮件
我正在编写一个脚本,该脚本将向一系列人员发送电子邮件,并且该电子邮件将包含一个附件。
我一直遇到这个问题:/usr/local/lib/ruby/1.9.1/net/smtp.rb:942:in 'check_response': 552 抱歉,邮件大小超出了我的数据字节限制 (#5.3.4) (Net::SMTPFatalError )
附件只有 110kb
代码:
Pony.mail(
:to => to,
:from => 'Me <[email protected]>',
: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
}
)
知道什么可能是错误的吗?
I am writing a script that is going to be sending out emails to a list of people and with this email there is going to be an attachment.
I keep running into this issue:/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)
The attached file is only 110kb
Code:
Pony.mail(
:to => to,
:from => 'Me <[email protected]>',
: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
}
)
Any idea on what could be wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这表明您要发送邮件的邮箱空间不足。
该错误是 SMTP 错误:
存储分配
552 请求的邮件操作已中止:超出了rfc http://www.ietf.org/ 中概述的 rfc/rfc2821.txt。
因此,要么邮箱已满,要么您正在发送无法放入其中的内容
This is telling you that the mailbox you are sending it to, has run out of space.
The error is an SMTP error :
552 Requested mail action aborted: exceeded storage allocation
outlined in the rfc http://www.ietf.org/rfc/rfc2821.txt.
So either the mail box is full or you are sending something that will not fit in it
请使用这个
也许这会解决你的问题。
Please use this
Probably this will solve your problem.