Showing posts with label Drupal. Show all posts
Showing posts with label Drupal. Show all posts

Thursday, March 11, 2010

Email Content Type

I have a Drupal 6.15 instance that uses the SimpleNews(6.x-1.0) and Mimemail(6.x-1.0-alpha1) modules.

When I send a newsletter and receive it in Outlook 2007 I receive a poorly formatted text email with an html attachment. What I want is for the html attachment to be the email.

At first glance this is a client side problem with the client(Outlook) not interpreting the content-type correctly. But it is not real important if that is correct or not because I cannot expect all of the customers to change their email clients just for me. So I need to change something on the server side to force this to appear correctly in the email clients of the customers.

The content type I am seeing the received email is
Content-Type: multipart/alternative; charset="utf-8";



I read some forums and dug around in the Mimemail module code and decided to change the module to force the content type to multipart/mixed.

To do this added an extra line to mimemail.inc at line 321

$content_type = 'multipart/mixed';
return mimemail_multipart_body($parts, "$content_type; charset=utf-8");

After sending a few test emails this seems to have addressed the problem. There may be a better or more correct way to address this but it works for now.

UPDATE:
There was an update to the Mimemail Module that invalidates the line number I mentioned before.

The new version is 6.x-1.0-alpha2 dated 24 March 2010.

 The following line is the last line and the return from the function mimemail_html_body
return mimemail_multipart_body($parts, "$content_type; charset=utf-8"); 

What you want to do is force the mime type just before the function returns. So just prior to the return set the mimetype with the following line.

$content_type = 'multipart/mixed';

Thursday, December 10, 2009

CSS Hell

Cascading Style Sheets can be very powerful tools. However debugging them when things do not go according to plan can be a real pain.

I decided to try my hand at a little Drupal theming and I am off to a rocky start. Some of the important files are:


  • themename.info — A required file that is new to Drupal 6 which provides information about the theme.
  • page.tpl.php — The main template that defines the content on most of the page.
  • style.css — The CSS file that sets the CSS rules for the template.
  • node.tpl.php — This file defines the content of the nodes.
  • block.tpl.php — Defines the content of the blocks.
  • comment.tpl.php — Defines the content of the comments.
  • logo.png — Your logo, if you are using one.
  • screenshot.png — This is a screenshot of your theme that is used in the admin panel and in the user account settings if you have enabled more than one theme so that visitors can choose which theme they want to use.
  • box.tpl.php — puts a box around things like comments.


How to make a Drupal theme
.