postmark-api-email-attachment Blogs
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Kiprosh is now part of LawLytics
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Previously, I have added post on send email from application via postmark. [Check Here..][1] Now will see how to send attachment with email. In rails, action-mailer provides an easy way to add attachment file as attachments['filename.jpg'] = File.read('/path/to/filename.jpg') Links: [rails-guide-on-attchments(send attachments with email)][2] , [rails-attachments][3] Sending attachments via Postmark-api require "open-uri" def send_refer_pt_request(params, attachment) # attachment -> url of file saved on S3 if attachment.present? mime_type = MIME::Types.type_for(attachment).first url_data = open(attachment).read() attachments["#{attachment.split('/').last}"] = { mime_type: