我们有API
内置的 Ruby 和Sinatra
gem。并Pony
用于发送电子邮件。我想设置参数reply-to
。我已经尝试了所有可能性,即使是 Pony gem 文档所说的方式,但它根本不起作用..
我们的邮件代码是
require 'logjam'
require 'pony'
module Evercam
module Mailers
class Mailer
LogJam.apply(self, "actors")
@@templates = {}
def initialize(inputs)
@inputs = inputs
end
def erb(name)
ERB.new(template(name)).result(binding)
end
private
def template(name)
@@templates[name] ||= File.read(
File.expand_path(File.join('.', name))
)
end
def method_missing(name)
if @inputs.keys.include?(name)
@inputs[name]
end
end
def self.method_missing(name, *inputs)
if self.method_defined?(name) && inputs[0]
begin
opts = self.new(inputs[0]).send(name)
mail = Evercam::Config[:mail].merge(opts)
Pony.mail(mail)
rescue Exception => e
log.warn(e)
end
end
end
end
end
end
require_relative 'mailer'
module Evercam
module Mailers
class UserMailer < Mailer
def confirm
{
to: user.email,
subject: 'Evercam Confirmation',
html_body: erb('templates/emails/user/confirm.html.erb'),
body: erb('templates/emails/user/confirm.txt')
}
end
def share
{
to: email,
subject: "#{user.fullname} has shared a camera with you",
html_body: erb('templates/emails/user/camera_shared_notification.html.erb'),
attachments: attachments,
reply_to: sharer
}
end
def share_request
{
to: email,
subject: "#{user.fullname} has shared a camera with you",
html_body: erb('templates/emails/user/sign_up_to_share_email.html.erb'),
attachments: attachments,
reply_to: sharer
}
end
def interested
{
to: 'signups@evercam.io',
subject: 'Signup on evercam.io',
body: erb('templates/emails/user/interested.txt')
}
end
def app_idea
{
to: 'garrett@evercam.io',
subject: 'Marketplace idea on evercam.io',
body: erb('templates/emails/user/app_idea.txt')
}
end
def create_success
{
to: archive.user.email,
subject: "Archive #{archive.title} is ready.",
html_body: erb('templates/emails/user/archive_create_completed.html.erb'),
attachments: attachments
}
end
def create_fail
{
to: archive.user.email,
subject: "Archive #{archive.title} failed.",
html_body: erb('archive_creation_failed.html.erb'),
attachments: attachments
}
end
end
end
end
reply_to inshare
和 inshare_request
根本不起作用.. 任何帮助将不胜感激。谢谢