Permalink
Browse files

a bit of mail safety

  • Loading branch information...
1 parent 2965e30 commit 96695694c464b6b1cca11454c7c77f7dc1103829 @paulanthonywilson paulanthonywilson committed Apr 14, 2012
Showing with 20 additions and 11 deletions.
  1. +8 −1 app/views/admin/proposals/index.html.erb
  2. +1 −1 config/environments/development.rb
  3. +11 −9 config/initializers/mail.rb
@@ -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({
@@ -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
@@ -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.