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

Possible email format problem in Chapter 20: Send Email - Create the Mailer View #83

Open
morinoko opened this issue Mar 30, 2016 · 1 comment

Comments

@morinoko
Copy link

In noticed a possible bug in Chapter 20: Send Email - Create the Mailer View

When implementing the app/views/user_mailer/contact_email.html.erb, we provide the DOCTYPE, head tags and body tags in the file.

screen shot 2016-03-30 at 18 01 25

However, when sending a test email, I first got a message within the email saying it could not be displayed because of the way it was formatted. Checking the console showed the email was given extra <html> and <body> tags on top of the ones that we already provided:

----==_mimepart_56fb928df1b01_cb43fd1e79cfc90908fe
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<html>
  <body>
    <!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  </head>
  <body>
    <h1>Website Contact</h1>
    <p>
      This visitor requested contact:
    </p>
    <p>
      Felice<br/>
      [email protected]<br/>
    </p>
    <p>
      The visitor said:
    </p>
    <p>
      "Test email"
    </p>
  </body>
</html>

  </body>
</html>

----==_mimepart_56fb928df1b01_cb43fd1e79cfc90908fe--

It seems that the Mailer is already providing the Doctype, head tags, as well as <html> and <body> tags. I removed the extra tags in the user_mailer/contact_email.html.erb file and it displayed fine after that:

screen shot 2016-03-30 at 18 08 30

Also no extra tags in the console outputs:

----==_mimepart_56fb93f0326df_cb43fd1e56ab638910fd
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<html>
  <body>
    <h1>Website Contact</h1>
<p>
  This visitor requested contact:
</p>
<p>
  Felice<br/>
  [email protected]<br/>
</p>
<p>
  The visitor said:
</p>
<p>
  "test 2
"
</p>

  </body>
</html>

----==_mimepart_56fb93f0326df_cb43fd1e56ab638910fd--

Should this be changed?

@anjanakrishnan
Copy link

hi I am working on it and I created a separate layout for user mailer.

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

No branches or pull requests

2 participants