Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oleg
committed
Jul 27, 2010
1 parent
3500015
commit 46832da
Showing
17 changed files
with
186 additions
and
278 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
log/* | ||
tmp/*/* | ||
tmp/*/* | ||
db/*.sqlite3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class WelcomeController < ApplicationController | ||
|
||
def index | ||
@api_key = PostageApp.config.api_key | ||
@api_key = nil if @api_key.blank? || @api_key == 'PROJECT_API_KEY' | ||
|
||
@subject = params[:subject] || 'Hello {{name}}' | ||
@to = params[:to] || 'me@example.com' | ||
@variable = params[:variable] || 'Tester' | ||
@html = params[:html] || "<h1>Hi, {{name}}</h1>\n<p>This is a test.</p>" | ||
@text = params[:text] || "Hi, {{name}}\nThis is a test." | ||
|
||
@response = Mailer.deliver_message(params) if request.post? | ||
end | ||
|
||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module WelcomeHelper | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'postageapp/mailer' | ||
|
||
class Mailer < PostageApp::Mailer | ||
|
||
def message(params) | ||
headers 'Reply-To' => 'sender@examlple.com' | ||
subject params[:subject] | ||
recipients params[:to] => { 'name' => params[:variable] } | ||
from 'sender@example.com' | ||
body :text_content => params[:text], :html_content => params[:html] | ||
end | ||
|
||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'> | ||
<head> | ||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | ||
<%= stylesheet_link_tag 'style' %> | ||
<title>Ruby on Rails 2 Example Application for PostageApp</title> | ||
</head> | ||
|
||
<body> | ||
<div class='body_wrapper'> | ||
<h1> | ||
Ruby on Rails 2 Example Application for PostageApp | ||
</h1> | ||
|
||
<%= yield %> | ||
|
||
<ul> | ||
<li><a href='http://postageapp.com'>PostageApp</a></li> | ||
<li><a href='http://github.com/theworkinggroup/postageapp-gem'>PostageApp Ruby Gem</a></li> | ||
<li><a href='http://help.postageapp.com'>PostageApp Help Portal</a></li> | ||
</ul> | ||
</div> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<%= @html_content %> | ||
|
||
HTML content |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<%= @text_content %> | ||
|
||
Plain text content |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<div class='api_key'> | ||
<% if @api_key %> | ||
API KEY: <span><%= @api_key %></span> | ||
<% else %> | ||
Please insert your project API KEY in <span>/config/initializers/postageapp.rb<span> | ||
<% end %> | ||
</div> | ||
|
||
<% if @response %> | ||
<div class='response'> | ||
<pre><%= @response.to_yaml %></pre> | ||
</div> | ||
<% end%> | ||
<% form_tag root_path do %> | ||
<label> Subject | ||
<%= text_field_tag :subject, @subject %> | ||
</label> | ||
<label>To ( email address ) | ||
<%= text_field_tag :to, @to %> | ||
</label> | ||
<label> Name ( {{name}} variable ) | ||
<%= text_field_tag :variable, @variable %> | ||
</label> | ||
<label> HTML Content | ||
<%= text_area_tag :html, @html %> | ||
</label> | ||
<label> Plain Text Content | ||
<%= text_area_tag :text, @text %> | ||
</label> | ||
<%= submit_tag 'Send Message' %> | ||
<% end %> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
PostageApp.configure do |config| | ||
config.api_key = 'ikm6a818RO4cPeS8EPRpDGQ9a63mPtDp' | ||
config.api_key = 'PROJECT_API_KEY' | ||
end |
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.