-
-
Save brentvatne/1713331 to your computer and use it in GitHub Desktop.
my ideal api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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