I am using Simplenews with Mimemail and trying to send HTML formatted emails, All seems to work except that the email are center aligned.

I see form the email header the following which is what I think is my problem.

Where do I change this.


text-align:center;margin:40px020px0;'>

Online Survey

CommentFileSizeAuthor
EmailHeader.txt7.89 KBgordon.waters

Comments

tallsimon’s picture

i have the same problem. where does it take this style from?

Carl242’s picture

Sam problem here. Using simplenews with mimemail. I can't figure out where that text-aligh:center comes from

Carl242’s picture

I think I might be onto something here: how many of you are using Marinelli or sub-theme based on it? I have found the following code in style.css inside the Marinelli theme folder

body {
	font-family: "Lucida Grande","Lucida Sans Unicode", helvetica, verdana, arial, sans-serif;
	line-height:1.125em;/*18px*/
	font-size:76%;/*set regular font size*/
	letter-spacing:normal;
	text-align: center;
	}

and the following code inside the mimemail.tpl.php file inside /modules/mimemail/theme

  <body id="mimemail-body">
     <div id="center">
      <div id="main">
        <?php print $body ?>
      </div>
    </div>
  </body>

To me this looks like it is calling the "body" style, but for some reason the "body" style is centered in the Marinelli css file. I'm going to do some testing to prove this by making a "mail" style that is not centred and then changing the tpl.php file to call the "mail" style instead. FYI I already tried commenting out "the "div id="center"" and that did nothing. I will update this thread with my findings.

poehnix’s picture

I am using a marinelli subtheme too. A quick test putting an empty mail.css in the theme folder does not seem to solve the issue.
(No css/js compression)

tallsimon’s picture

Thank you carl242, you are correct! I was using marinelli, and changing this setting seemed to work. for reference for others:

from marinelli theme style:

body {
font-family: "Lucida Grande","Lucida Sans Unicode", helvetica, verdana, arial, sans-serif;
line-height:1.125em;/*18px*/
font-size:76%;/*set regular font size*/
letter-spacing:normal;
text-align: center;
}

i copied and pasted the necessary part into my sub-theme, editing the alignment. therefore added to my sub-theme style.css:

body {
text-align: left;
}

Importantly, I then flushed the caches (admin menu makes this easy!!) and hey presto, a test message was left-aligned.
Another triumph of the drupal community's joint problem-solving!

poehnix’s picture

The problem with tallsimon solution is theme css editing is needed, which is not a good thing. A tpl override or adding an empty css file would be better

mtpultz’s picture

Are you guys able to get html emails in hotmail or does Mimemail not sending the newsletter in the proper format?

Carl242’s picture

Well Talismon that was one way to go about it . . . but I found that the Marinelli theme's templates were really complex and it was a bit beyond me to get EVERYTHING to work (including space btw paragraphs and getting lists to format correctly). Instead, I found something of use in the following issue:

http://drupal.org/node/614782

Basically it said to create a custom mail.css inside your theme directory (in my case gnifetti) and to copy the mimemail.tpl.php file there. I used a blank .css file and got exactly what I wanted, but I can see this might be an easier way to get all the formatting you want in your html mails and only that (instead of the email being like 200k large). Hope that helps :)

gordon.waters’s picture

I have tried a few of these but nothing seems to left align my HTML mail, has anyone got any further with this. I am using Aboutpeople as my theme. The problem is with HTML formatted mail.

Gordon

sgabe’s picture

@gordon.waters: As Carl242 wrote before, you have too a text-align:center; property assigned to the body element.

body {
  background:url("/majorscreek/sites/all/themes/aboutpeople/img/bg.gif") repeat scroll 0 0 #EDEDED;
  color:#333333;
  font-family:"Lucida Grande","Lucida Sans Unicode",helvetica,verdana,arial,sans-serif;
  font-size:100%;
  letter-spacing:normal;
  line-height:1.125em;
  margin:40px 0 20px;
  text-align:center;
}

When MimeMail doesn't find a mail.css, gathers all style sheets from your site and uses those for the e-mails.

You need to do one of the following to fix the problem:

  • Remove or modify the text-align property in your theme's style.css. When you will update your theme, this will be lost, so this isn't the lucky pick.
  • Remove or modify the text-align property in a new style.css within a sub-theme. That would be better.
  • Create a mail.css file in your (if you are using sub-themes, place it in the parent's) theme folder. The best solution.
gordon.waters’s picture

@sgabe Thanks for the update, on initial testing the mail.css options seems to work, but I need to do a little more testing which I will be doing today.

sgabe’s picture

Status: Active » Closed (fixed)

@gordon.waters: No activity, so I assume you have found the solution to your problem and I am closing this.

itserich’s picture

For the benefit of anyone else who barely knows what we are doing...

I was receiving email with centered text in D7. The solution was go to:

admin/config/system/mimemail

and Unclick Include Site Style Sheets.