发送电子邮件附件与Ruby与小宝石 [英] Sending email with attachments in Ruby with the Pony Gem
问题描述
我正在写一个将要发送电子邮件给一个人的列表的脚本,并且这个电子邮件将是一个附件。
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.
我保持遇到这个问题:
/usr/local/lib/ruby/1.9.1/net/smtp.rb:942:in'check_response':552对不起,那个消息大小超过我的数据限制(#5.3.4)(Net :: SMTPFatalError)
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)
附加文件只有110kb
The attached file is only 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
}
)
任何想法可能是错的? p>
Any idea on what could be wrong?
推荐答案
这是告诉你,你发送的邮箱已经用完了。
This is telling you that the mailbox you are sending it to, has run out of space.
错误是SMTP错误:
552请求的邮件操作中止:超出存储分配
The error is an SMTP error : 552 Requested mail action aborted: exceeded storage allocation
在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
这篇关于发送电子邮件附件与Ruby与小宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!