Why a proprietary attachments API? #17

jjb opened this Issue Jan 3, 2012 · 9 comments

6 participants

jjb commented Jan 3, 2012

Why doesn't the gem use the ActionMailer attachments API, or at least capture it if the hash is present? It seems like the parameters involved are identical or a subset:



Really why?

jjb commented Feb 5, 2012

@iSabanin @wildbit any thoughts on this?


This was the reason it developed my own gem: simple_postmark which supports the standard Rails attachments API.

It's already mentioned in the official docs, in case you missed it.

Wildbit member

Thank you for pushing this! Native attachments support is coming this week. I'll let you know when you can update.

Wildbit member

Yesterday I released postmark gem 0.9.19 which supports native attachments API provided by Ruby Mail library. It makes the gem compatible with ActionMailer attachments API too. Legacy API is kept for compatibility reasons, but will be deprecated after version 1.0.

class TestMailer < ActionMailer::Base
  default :from => "sender@wildbit.com"

  def some_email
    attachments['1.jpeg'] = File.read(Rails.root.join('tmp/1.jpeg'))
    mail :subject => 'Native attachments API', :to => 'tema@wildbit.com'
@temochka temochka closed this Feb 19, 2013

Can you post a simple snippet for saving attachments from an email using th native API , too? thanks

Wildbit member

Sorry, what exactly do you mean by "saving attachments"? If you're talking about Postmark Inbound, the rails gem currently doesn't provide any support for that.


woot! thanks @temochka !

in my implementation, after updating, now each attachement is sent twice. this is because i was populating both the ActionMailer hash and the proprietary postmark hash so whichever context i was in would just use it. not a big deal for my use case, but just pointing that out -- maybe you could do a simple check for redundancy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment