Permalink
Browse files

Created a very basic automatic email app

  • Loading branch information...
0 parents commit 5fa7064a05ac2420f85a57674c540b9282f4f9ef @johndbritton committed Nov 10, 2010
Showing with 51 additions and 0 deletions.
  1. +3 −0 Gemfile
  2. +19 −0 README.md
  3. +21 −0 Rakefile
  4. +6 −0 app.rb
  5. +2 −0 config.ru
@@ -0,0 +1,3 @@
+source :gemcutter
+gem 'sinatra'
+gem 'pony'
@@ -0,0 +1,19 @@
+Heroku Auto Emailer
+===================
+
+Send an email automatically every other Wednesday using Heroku.
+
+Automated emails in 10 seconds
+------------------------------
+
+ $ git clone git://github.com/johndbritton/heroku-auto-emailer.git heroku-auto-emailer
+ $ cd heroku-auto-emailer
+ $ heroku create
+ $ git push heroku master
+ $ heroku addons:add sendgrid:free
+ $ heroku addons:add cron:daily
+
+Customize
+---------
+
+Edit the Rakefile to change subject, from, to, body and message frequency.
@@ -0,0 +1,21 @@
+require 'rubygems'
+require 'pony'
+
+task :cron do
+ puts Date.today.wday == 3 && Date.today.cweek % 2 == 1
+ if Date.today.wday == 3 && Date.today.cweek % 2 == 1 then
+ Pony.mail :to => 'to-address@example.com',
+ :from => 'from-address@example.com',
+ :subject => '[Subject] ' + Date.today.to_s,
+ :body => "Message here. You can use \n to start a new line!",
+ :via => :smtp,
+ :via_options => {
+ :address => 'smtp.sendgrid.net',
+ :port => '25',
+ :authentication => :plain,
+ :user_name => ENV['SENDGRID_USERNAME'],
+ :password => ENV['SENDGRID_PASSWORD'],
+ :domain => ENV['SENDGRID_DOMAIN']
+ }
+ end
+end
6 app.rb
@@ -0,0 +1,6 @@
+require 'rubygems'
+require 'sinatra'
+
+get '*' do
+ 'Heroku Auto Mailer - <a href="http://github.com/johndbritton/heroku-auto-mailer">http://github.com/johndbritton/heroku-auto-mailer</a>'
+end
@@ -0,0 +1,2 @@
+require 'app'
+run Sinatra::Application

0 comments on commit 5fa7064

Please sign in to comment.