Bug 916972

Summary: [fork][US3420]The email service does not work on the /app/account/help page.
Product: OKD Reporter: Yujie Zhang <yujzhang>
Component: WebsiteAssignee: Hiro Asari <hasari>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: dmcphers, hasari, jkeck, xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-15 14:22:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Contact mail delivered none

Description Yujie Zhang 2013-03-01 10:31:30 UTC
Description of problem:

Changed the site/app/mailers/account_support_contact_mailer.rb to set this: 

default :to => "yujzhang"
mail(:to => "yujzhang", :from => @support_contact.from, :subject => @support_contact.subject)

, after clicking "send" button, I can not receive email.

Version-Release number of selected component (if applicable):
fork_ami_US3420_503 

How reproducible:
always

Steps to Reproduce:
1.Configure instance like above
2.Go to /app/account/help page
3.Input title and subject, then click "Send" button
  
Actual results:

Can not receive support request email which sent from /app/account/help page.Log is as following:

2013-03-01 05:24:25.138 [INFO ] Started POST "/app/account/contact" for 203.114.244.88 at 2013-03-01 05:24:25 -0500 (pid:18722)
2013-03-01 05:24:25.503 [INFO ] Processing by AccountController#contact_support as HTML (pid:18722)
2013-03-01 05:24:25.538 [INFO ] Parameters: {"utf8"=>"✓", "authenticity_token"=>"fDtrqkRG3F7bOem1Sl3+fVZS5VFo0WCFf5CWFlHaePY=", "support_contact"=>{"from"=>"wsun", "subject"=>"test", "body"=>"test"}, "commit"=>"Send"} (pid:18722)
2013-03-01 05:24:25.636 [DEBUG] params: {"from"=>"wsun", "subject"=>"test", "body"=>"test"} (pid:18722)
2013-03-01 05:24:26.759 [DEBUG] Contact email sent from wsun (pid:18722)
2013-03-01 05:24:27.395 [INFO ] Rendered account_support_contact_mailer/contact_email.html.erb (0.7ms) (pid:18722)
2013-03-01 05:24:27.293 [INFO ] Sent mail to yujzhang (142ms) (pid:18722)
2013-03-01 05:24:27.293 [DEBUG] Date: Fri, 01 Mar 2013 05:24:27 -0500
From: wsun
To: yujzhang
Message-ID: <513081db40a91_4922c73878849cd>
Subject: test
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  </head>
  <body>
    <h1>Account Support Request received from user X</h1>
    <p>
      test
    </p>
  </body>
</html> (pid:18722)


Expected results:

Should receive support request email which sent from /app/account/help page.

Additional info:

Comment 1 Hiro Asari 2013-03-05 22:07:01 UTC
On devenv, the app is running in development mode, for which we have:
  config.action_mailer.delivery_method = :test
so no delivery happens.

I'll try to figure out if there is a way to set up mail relay.

Comment 2 Hiro Asari 2013-03-06 21:41:14 UTC
Created attachment 706271 [details]
Contact mail delivered

This is strictly an issue with development environment configuration. It takes a little bit of effort, but you can test that the form works fine.

1. Edit /var/www/openshift/site/config/environments/development.rb:

1.a. Configure the recipient for the contact form:

  config.acct_help_mail_to = '<YOURNAME>@redhat.com'


1.b. Configure ActionMailer so that it uses SMTP. A typical configuration might look like:

  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :address              => "smtp.gmail.com",
    :port                 => 587,
    :domain               => 'gmail.com',
    :user_name            => '<username>',
    :password             => '<password>',
    :authentication       => 'plain',
    :enable_starttls_auto => true  }

2. Restart 'rhc-site' service with "service rhc-site restart".

3. Go to https://<devenv>/app/account/help and send contact email.

If you are using a Gmail account (as shown above in 1.b.), this may result in a warning email from Google, indicating that they've detected suspicious activity. Use your browser to log in to the Gmail account, and follow the instruction at the top to allow temporary access.

4. Got to https://<devenv>/app/account/help and send contact email again.

This should result in email as shown in the attached screenshot.

To reiterate: this is strictly a configuration issue, which should not manifest on production.

Comment 3 Yujie Zhang 2013-03-07 12:57:12 UTC
Tested on fork_ami_US3420_503 with above steps, the email can be received after the configuration, so verify this bug now.