Skip to content

Instantly share code, notes, and snippets.

@brentvatne
Forked from practicingruby/mail_server.rb
Created January 31, 2012 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brentvatne/1713331 to your computer and use it in GitHub Desktop.
Save brentvatne/1713331 to your computer and use it in GitHub Desktop.
my ideal api
class MailingLst < PostalService::App
config.some_config_var = ".."
filter(:unsubscribed_users) do
!list_members.include?(incoming.from)
end
filter(:subscribed_users) do
list_members.include?(incoming.from)
end
unsubscribed_users do
to "subscribe@#{config.domain}" do
outgoing.subject = "SUBSCRIBED!"
list_members << incoming.from
end
end
subscribed_users do
to "unsubscribe@#{config.domain}" do
outgoing.subject = "UNSUBSCRIBED!"
outgoing.body = "Sorry to see you go!"
end
subject /*/ do
outgoing.reply_to = CONFIGURATION_DATA[:default_sender]
outgoing.bcc = list_members.join(", ")
outgoing.subject = incoming.subject
outgoing.body = incoming.body.to_s
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment