在shoppe中编辑电子邮件视图

时间:2015-08-07 20:38:33

标签: ruby-on-rails actionmailer

我似乎无法在stackoverflow中找到shoppe标记。

我使用Shoppe gem作为rails。

我想知道是否有办法编辑订单放在购物中时发送的电子邮件的视图。

我希望在您接受订单时为电子邮件添加附件。

谢谢!

2 个答案:

答案 0 :(得分:2)

您似乎可以重新定义Shoppe的邮件程序方法:

module Shoppe
  class OrderMailer < ActionMailer::Base

    def received(order)
      @order = order
      attachment(content_type: 'image/jpeg', body: File.read('image.jpg'))
      mail :from => Shoppe.settings.outbound_email_address, :to => order.email_address, :subject => I18n.t('shoppe.order_mailer.received.subject', :default => "Order Confirmation")
    end
  end
end

将某个地方放入app/initializers。请记住正确设置内容类型。

答案 1 :(得分:1)

对于那些只想像我一样改变实际文字的人来说,这是最好,最快的解决方案。

您可以直接转到电子邮件的文件并进行编辑。我所做的就是访问确切的文件Here并重新创建该文件及其路径到我自己的应用程序中并将这些文字更改为我喜欢的文件。

https://github.com/tryshoppe/shoppe/blob/master/app/views/shoppe/order_mailer/accepted.text.erb