Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6901253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:39:00+00:00 2026-05-27T07:39:00+00:00

I have some content which in the database has linebreaks stored and when I

  • 0

I have some content which in the database has linebreaks stored and when I view my content on the browser using simple_format I see the content displaying with linebreaks which is good. The issue is that when I send email, the line breaks are removed and it all shows up on one line. Here’s my mailer..

def new_announcement(announcement)
  @announcement = announcement
  addresses = @announcement.email_list.split(',')
  mail(:to => addresses, :from => @announcement.from_email, :subject => @announcement.title, :content_type => "text/html") do |format|
    format.html
  end
end

..and then in my view new_announcement.html.erb

<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  </head>
  <body>
    <p>
      <%= simple_format @announcement.content %>
    </p>
    <div class="faint-display">
      This announcement was sent via the iTeam Announcements page for DA (<%= link_to "http://goto/iteam", "goto/iteam" %>)
    </div>
  </body>
</html>

The content for an announcement shows up on one line and not the way it does with linebreaks in the browser. Is there something I’m doing wrong? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:39:00+00:00Added an answer on May 27, 2026 at 7:39 am

    Ok, so figured it out. Turns out that the email view has no idea of the layout (CSS source) or any helper methods in the application so you need to explicitly mention those. This is what i have not and it works great!

    <!DOCTYPE html>
    <html>
      <head>
        <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" >
        <style type="text/css" media="screen">
           body {font-family: verdana; font-size: 10pt}
           div {color: gray; font-style:italic; font-size: 8pt}
        </style>
      </head>
      <body>
        <p>
            <%= ApplicationController.helpers.simple_format(@announcement.content) %>
        </p>
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen some mails which has HTML content embedded in them. The content
I have some content that I am loading using jquery ajax. The content has
I have a class library project which contains some content files configured with the
I have a flex app which allows user to create some content. this content
I have a script which collects an image, link and some text content from
I have a window in WPF which shows some media contents. This content contains
I have some content from server using $.ajax() function. I try to replace some
I have a osCommerce 2.2 MST which has some custom additions to it. osCommerce
I have an application which gets some data from a remote database. I use
I currently have a system in which one rails 2.3.2 has a database with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.