Skip to content

Commit

Permalink
a bit of mail safety
Browse files Browse the repository at this point in the history
  • Loading branch information
paulanthonywilson committed Apr 14, 2012
1 parent 2965e30 commit 9669569
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
9 changes: 8 additions & 1 deletion app/views/admin/proposals/index.html.erb
Expand Up @@ -13,14 +13,21 @@
<div id="email">
<input id="subject" type="text">
<textarea id="body" type="text"></textarea>
<%= button_to_function "Send to selected", "sendEmailToSelected()" %>
<%= button_to_function "Send to selected", "sendEmailToSelected()" %>
</div>
<script>
var sendEmailToSelected;
$(function(){
sendEmailToSelected = function(){
var proposal_ids = $.makeArray($('.select_proposal:checked')
.map(function(){return parseInt($(this).val());}));
if (proposal_ids.length < 1){
alert("You didn't select anything, fool!");
return;
}
if (!window.confirm("Are you really sure you want to email these people? This is your last chance to walk away.")){
return;
}
var subject = $('#subject').val();
var body = $('#body').val();
$.ajax({
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Expand Up @@ -14,7 +14,7 @@
config.action_controller.perform_caching = false

# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true
config.action_mailer.raise_delivery_errors = false

# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
Expand Down
20 changes: 11 additions & 9 deletions config/initializers/mail.rb
@@ -1,9 +1,11 @@
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => 'conference@scottishrubyconference.com',
:password => 'is-oas-jeb-yac',
:domain => 'scottishrubyconference.com'
}
ActionMailer::Base.delivery_method = :smtp
if Rails.env == "production"
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => 'conference@scottishrubyconference.com',
:password => 'is-oas-jeb-yac',
:domain => 'scottishrubyconference.com'
}
ActionMailer::Base.delivery_method = :smtp
end

0 comments on commit 9669569

Please sign in to comment.