如何使用rails发送'Mark as Important'邮件

时间:2011-05-25 10:59:20

标签: ruby-on-rails ruby html-email email-integration

我需要你的观点,因为我不知道是否可能。

我希望我的应用程序发送一些电子邮件'Mark as Important',以便当最终用户在Evolution/Outlook收到此邮件时,他们应该知道电子邮件的重要性。

目前,当我使用evolution 'Mark as Important'标记任何电子邮件时,它会将邮件主题和其他字段的颜色更改为red

3 个答案:

答案 0 :(得分:7)

其他两个答案都是正确的,但问题是,Outlook使用非标准标头来表示信号重要性。它被称为X-Priority,因此您必须将其包含在外发邮件中。对于较旧的Outlook,您还可以包含“X-MSMail-Priority:High”。


def notification
  mail({
      :to => 'email@example.com',
      :subject => 'My subject',
      :from => 'me@somewhere.com',
      'Importance' => 'high',
      'X-Priority' => '1'}) do |format|
    format.text
    format.html
  end
end

答案 1 :(得分:6)

class Notifier < ActionMailer::Base
  default :from => 'no-reply@example.com',
          :return_path => 'system@example.com'

  def welcome(recipient)
    @account = recipient
    mail(:to => recipient.email_address_with_name,
         :bcc => ["bcc@example.com", "Order Watcher <watcher@example.com>"],
         :subject => "No way!",
         :importance => "High") # <======
    end
  end

答案 2 :(得分:1)

MIME RFC将重要性列为可以使用MIME电子邮件发送的标头。可以使用的值是高,正常或低。要发送具有调整后重要性的电子邮件,请使用允许您通过API方法设置重要性的API,或允许您设置单个标头的API(例如TMail)。

我不认识Ruby,所以我不能给你一个例子,但希望这能指出你正确的方向。