Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Why a proprietary attachments API? #17

Closed
jjb opened this Issue · 9 comments

6 participants

John Bachir Dmytrii Nagirniak Pete Nicholls Mario Uher Artem Chistyakov RealMassiveCEO
John Bachir
jjb commented

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:

http://api.rubyonrails.org/classes/ActionMailer/Base.html#method-i-attachments

Dmytrii Nagirniak

Really why?

John Bachir
jjb commented

@iSabanin @wildbit any thoughts on this?

Mario Uher

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.

Artem Chistyakov
Owner

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

Artem Chistyakov
Owner

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'
  end
end
Artem Chistyakov temochka closed this
RealMassiveCEO

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

Artem Chistyakov
Owner

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.

John Bachir

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
Something went wrong with that request. Please try again.