Yahoo! 错误地内嵌显示 Rails 3 ActionMailer 附件邮件

发布于 2024-10-18 22:21:36 字数 1472 浏览 5 评论 0原文

我正在使用 ri_cal gem 生成 ics 文件。

在我的邮件程序中:--

def appointment_book(appointment,recipient,appointment_with)
  event = RiCal.Event do
    description "MA-6 First US Manned Spaceflight"
    dtstart     DateTime.parse(appointment.slot.date_on.strftime("%m/%d/%Y").to_s + " " + appointment.slot.start_time.strftime("%I.%M %p").to_s)
    dtend       DateTime.parse(appointment.slot.date_on.strftime("%m/%d/%Y").to_s + " " + appointment.slot.end_time.strftime("%I.%M %p").to_s)
    add_attendee appointment_with.full_name
    alarm do
      description "Segment 51"
    end
  end
  attachments['event.ics'] = { 
   :mime_type => 'text/calendar', 
   :content => event.export 
   }

  @recipient = recipient
  @appointment = appointment
  mail(:to => recipient.email, :subject => "Appointment book")
end

在 appintment_book.text.erb 文件中

  (some simple variable values or plain text.)

问题是(在雅虎中,特别是较新的版本。我在编辑部分添加屏幕截图):--

附件中有邮件,但除了 gmail 之外,邮件的内容还有一些电子名片和其他内容。如果我删除 ics_ Generation 代码,那么它就消失了。请检查屏幕截图

在 gmail 中,它看起来像这样(也适用于 hotmail):--

gmaill Look

编辑

在 yahoo Classic 中工作。

在 yahoo classic 中工作

不在 New yahoo 中工作: --

在此处输入图像描述

I am using ri_cal gem to generate ics file.

In my mailer:--

def appointment_book(appointment,recipient,appointment_with)
  event = RiCal.Event do
    description "MA-6 First US Manned Spaceflight"
    dtstart     DateTime.parse(appointment.slot.date_on.strftime("%m/%d/%Y").to_s + " " + appointment.slot.start_time.strftime("%I.%M %p").to_s)
    dtend       DateTime.parse(appointment.slot.date_on.strftime("%m/%d/%Y").to_s + " " + appointment.slot.end_time.strftime("%I.%M %p").to_s)
    add_attendee appointment_with.full_name
    alarm do
      description "Segment 51"
    end
  end
  attachments['event.ics'] = { 
   :mime_type => 'text/calendar', 
   :content => event.export 
   }

  @recipient = recipient
  @appointment = appointment
  mail(:to => recipient.email, :subject => "Appointment book")
end

in appintment_book.text.erb file

  (some simple variable values or plain text.)

Issue is (In Yahoo, specifically newer version. I am adding screenshots in edit part):--

attachment is there is mail, but apart from gmail content of the mail is having some vcard and other content. If i remove ics_generation code then its gone. Please check screenshots

In gmail it looks like (Also working on hotmail):--

gmaill look

EDIT

Working in yahoo Classic.

Working in yahoo classic

Not working in New yahoo:--

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

纸短情长 2024-10-25 22:21:36

我有点不确定你在展示和询问什么。假设第一个屏幕截图是一个未命名的邮件客户端,错误地显示了日历数据,而不是将其作为附件,并且您想要修复该问题,那么我建议您指定 mime 类型,如

 attachments['event.ics'] = { 
   :mime_type => 'text/calendar', 
   :content => event.export 
 }

我不能说这是否将有助于邮件客户端和/或日历数据,但它对大多数客户端中的 vCard 附件有帮助,如:

 attachments['card.vcs'] = { 
   :mime_type => 'text/x-vcard', 
   :content => person.to_vcf 
 }

感谢您的澄清,不幸的是这个问题我没有比“更好的答案”告诉雅虎”,这没有任何帮助。

我从几个不同的来源向雅虎邮件发送了附件,并尝试了不同的内容类型、传输编码(例如 Base64)、不同类型的附件等。我能在雅虎正确显示的附件和失败的附件之间找到的唯一常数是成功使用参数折叠,例如,

成功

Content-Disposition: attachment; filename="event.ics"

失败

Content-Disposition: attachment;
 filename="event.ics"

这种(正确的)折叠似乎是硬连线到mail gem,我没有尝试其他真正隔离它的方法;我不得不说,如果这确实是问题所在,我会感到惊讶。

无论如何,雅虎正在将非内联附件呈现为内联附件,因此,如果这对您的客户群来说是一个重大问题,我会直接与雅虎联系;也许他们会修复它,或者为您提供有关触发它的更具体的说明,以便您可以解决它。就其价值而言,雅虎确实允许用户正确访问附件,因为它应该使用“附件”的内容处置;它只是显示它好像处置是“内联的”。

顺便说一下,这个问题也影响了我的应用程序,所以我会继续思考我们可以尝试的事情。

I'm a bit unsure what you're showing and asking. Assuming the first screenshot is an unnamed mail client incorrectly showing the icalendar data instead of having it as an attachment and you're wanting to fix that, then I'd suggest you specify the mime type, as in

 attachments['event.ics'] = { 
   :mime_type => 'text/calendar', 
   :content => event.export 
 }

I can't say if this will help that mail client and/or calendar data, but it does the trick for vCard attachments in most clients, as in:

 attachments['card.vcs'] = { 
   :mime_type => 'text/x-vcard', 
   :content => person.to_vcf 
 }

Thanks for the clarification, unfortunately for that question I've no answer better than "tell Yahoo," which is no help.

I sent attachments to Yahoo mail from a few different sources and I tried different content types, transfer encodings (e.g., Base64), different kinds of attachments, etc. The only constant I can find between those that Yahoo shows properly and those it fails on is that the successes do not use parameter folding, e.g.,

Success

Content-Disposition: attachment; filename="event.ics"

Fail

Content-Disposition: attachment;
 filename="event.ics"

This (correct) folding appears to be hardwired into the mail gem that Rails uses and I didn't try another way of truly isolating it; I have to say I'd be surprised if that were really the problem.

Regardless, Yahoo is rendering non-inline attachments as inline, so if this is a significant problem for your customer base, I'd take it up with Yahoo directly; maybe they'll fix it or offer you a more concrete statement about what triggers it so you can work around it. For what it's worth, Yahoo does allow the user to access the attachment correctly as it should with Content-Disposition of "attachment"; it's just also showing it as if the Disposition where "inline."

By the way, this problem affects my apps as well, so I'll keep thinking about things for us to try.

坚持沉默 2024-10-25 22:21:36

此问题仅与 Yahoo! 有关邮件。雅虎真是太可惜了!邮件不管理 Yahoo! 中的 iCalendar 事件日历还没到,2011年了!

至少现在在“新”Yahoo! 中将事件作为 ICS 附件提供。邮件,您可以手动管理邀请。也许雅虎!经典过去了。我会检查并考虑是否可以恢复。

这是人们继续使用 Yahoo! 的唯一解决方案。网络邮件服务。当然有雅虎!由 POP3 电子邮件客户端管理的邮件帐户确实可以正确管理 iCalendars 事件:任何附加的 ICS 文件都会显示为会议邀请,您可以像往常一样通过电子邮件客户端进行管理。

看看这里,雅虎!开发者网络:

希望它有帮助,这么晚了。

This issue in only related to Yahoo! Mail. What a shame that Yahoo! Mail does not manage iCalendar events in Yahoo! Calendar yet, in 2011!

At least events are now provided as ICS attachments in "new" Yahoo! Mail and you can manage invitations manually. Maybe Yahoo! Classic did in the past. I will check and consider to revert possibly.

This is the only solution for people keeping on using Yahoo! Webmail service. Of course having a Yahoo! Mail account managed by a POP3 email client does manage iCalendars events properly: any attached ICS file shows up as a meeting invitation you can manage though your email client as usual.

Have a look here, at Yahoo! Developer Network : http://developer.yahoo.com/forum/General-Discussion-at-YDN/Problem-opening-ICS-files-from-Yahoo/1299668671000-24ed7a59-019f-3f1b-b596-70ab34db783c

Hope it helps,so late.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文