
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
fishman-postmark-rails
Advanced tools
= postmark-rails gem
The Postmark Rails Gem is a drop-in plug-in for ActionMailer to send emails via Postmark, an email delivery service for web apps. The gem has been created for fast implementation and fully supports all of Postmark’s features.
== Supported Rails Versions
== Install
sudo gem install postmark-rails
== Requirements
== Configuring your Rails application
=== Rails 3
Add this to your Gemfile: (change version numbers if needed)
gem 'postmark-rails', '0.4.0'
Don't forget to run "bundle install" command every time you change something in the Gemfile.
Add this to your config/application.rb:
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_key => "your-api-key" }
=== Rails 2
Add this to config/environment.rb:
Rails::Initializer.run do |config|
...
config.gem 'postmark-rails'
require 'postmark-rails'
config.action_mailer.postmark_api_key = "your-api-key"
config.action_mailer.delivery_method = :postmark
...
end
For API details, refer to the developer documentation at http://developer.postmarkapp.com.
== Tagging your deliveries
You can use a tag to categorize outgoing messages and attach application-specific information. Tagging the different types of email that you send lets you review statistics and bounce reports separately. Read more at http://developer.postmarkapp.com/developer-build.html#message-format.
=== Rails 3
class TestMailer < ActionMailer::Base
def tagged_message
mail(
:subject => 'hello',
:to => 'sheldon@bigbangtheory.com',
:from => 'leonard@bigbangtheory.com',
:tag => 'my-tag'
)
end
end
=== Rails 2
class SuperMailer < ActionMailer::Base
def email
from "no-reply@example.com"
subject "Some marvelous email message"
recipients "someone-fancy@example.com"
tag "my-another-tag"
end
end
== Sending attachments
You can also send file attachments with Postmark. Read more here: http://developer.postmarkapp.com/developer-build.html#attachments
=== Rails 3
class TestMailer < ActionMailer::Base
def message_with_attachment
mail(
:subject => 'hello',
:to => 'sheldon@bigbangtheory.com',
:from => 'leonard@bigbangtheory.com',
:postmark_attachments => [File.open("/path/to/file")]
)
end
end
=== Rails 2
class SuperMailer < ActionMailer::Base
def email
from "no-reply@example.com"
subject "Some marvelous email message"
recipients "someone-fancy@example.com"
postmark_attachments [File.open("/path/to/file")]
end
end
You can pass either an array of File objects or a single object. Postmark will detect the file name automatically and send an attachment with the "application/octet-stream" content type. If you want more control on how attachments get formatted, you can pass Hash objects, which contain the custom settings such as file name or content-type. Here is an example:
#
# Don't forget to read your file and base64-encode it,
# before assigning it to "Content".
#
message.postmark_attachments = {
"Name" => "fancy-file-name.jpg",
"Content" => [ IO.read("path/to/file") ].pack("m"),
"ContentType" => "image/jpeg"
}
== Note on Patches/Pull Requests
== Authors & Contributors
== Copyright
Copyright © 2010 Wildbit LLC. See LICENSE for details.
FAQs
Unknown package
We found that fishman-postmark-rails demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.