我将Mailgun与ActionMailer一起使用是这样的:
let currentDate = new Date();
let currentTime = (convertStringDateToDate(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate(), currentDate.getHours(),currentDate.getMinutes(),currentDate.getSeconds(),currentDate.getMilliseconds())).getTime();
console.log(currentTime); // 1537309553647
console.log(currentDate.getTime()); // 1537309553647
邮件出去像这样
config.action_mailer.delivery_method = :mailgun
config.action_mailer.mailgun_settings = {
api_key: 'key-b46eXXXXXXXXXXXX91c4',
domain: 'mg.eagle.com'
}
如何在邮件中添加标签? mailgun文档中有一个示例(https://documentation.mailgun.com/en/latest/user_manual.html#tagging),但是它不使用ActionMailer,而是在API上使用POST ...
答案 0 :(得分:0)
我找到了解决方案,实际上很简单:
在mail命令之前放置以下行:
headers['X-Mailgun-Tag'] = 'contact_us'
但是,这仅在合并Pull请求时才有效: https://github.com/mailgun/mailgun-ruby/pull/133
直到您可以在Gemfile中使用它:
gem 'mailgun-ruby', :github => 'mailgun/mailgun-ruby', :branch => 'sjohn/railgun-mailer-headers'