Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify users that their email is bouncing when they log in #323

Open
sebbacon opened this issue Jan 9, 2012 · 1 comment
Open

Notify users that their email is bouncing when they log in #323

sebbacon opened this issue Jan 9, 2012 · 1 comment

Comments

@sebbacon
Copy link
Contributor

sebbacon commented Jan 9, 2012

Currently we just silently disable email sending. We should let them know.

From a user email:

I have not been receiving emails since around mid-December. Looking
back at previous correspondence it seems this might be due to a
delivery failure, but that I should have been informed of this when
logging in to the site. I have logged in several times and checked
all my settings I am able and have discovered nothing amiss, nor
been informed of any email address errors.

Please could you investigate and restart my email delivery.
@robinhouston
Copy link
Contributor

I have found a (possibly incomplete) attempt at doing this:

diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index d3c42c7..86173cc 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -102,6 +102,10 @@ class UserController < ApplicationController
                 return
             else
                 # Successful login
+                if !@user_signin.email_bounced_at.nil?
+                    flash[:email_bounced] = true
+                end
+
                 if @user_signin.email_confirmed
                     session[:user_id] = @user_signin.id
                     session[:user_circumstance] = nil
diff --git a/app/views/general/_email_bounced.rhtml b/app/views/general/_email_bounced.rhtml
new file mode 100644
index 0000000..894ef9c
--- /dev/null
+++ b/app/views/general/_email_bounced.rhtml
@@ -0,0 +1,10 @@
+<div id="email_bounced">
+    <h1>Your email has bounced</h1>
+    <p>Last time we tried to email you at <%= @user.email %>, the message bounced.
+       Because of this, we will not send you any more emails until you reconfirm
+       your address.
+    </p>
+    <form method="post" action="">
+      <input type="submit" name="action" value="Reconfirm">
+    </form>
+</div>
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index 94ec5a9..0fff955 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -116,6 +116,9 @@
             <% if flash[:error] %>
                 <div id="error"><%= flash[:error] %></div>
             <% end %>
+            <% if flash[:email_bounced] %>
+                <%= render :partial => 'general/email_bounced' %>
+            <% end %>

             <div id="<%= controller.controller_name + "_" + controller.action_name %>" class="controller_<%= controller.controller_n
             <%= yield :layout %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants