Solved

Problem sending HTML messages with MIME::Lite to Hotmail

Posted on 2004-04-26
2
557 Views
Last Modified: 2011-10-03
Hi there people.

I have a problem on using MIME::Lite (3.01) to send HTML messages. The problem is that no matter what I do I cannot get these messages to display in Hotmail.

Currently the code for sending my HTML message is as follows:

[code]
$msg = MIME::Lite->build(       From    => $from,
                                  Sender  => $acc_reply_email,
                                  To      => $to,
                                  Cc      => $cc,
                                  Bcc     => $bcc,
                                  ReplyTo => $acc_reply_email,
                                  Subject => $subject,
                                  ReturnPath => $acc_reply_email,
                                  Type    => "multipart/related");


  #Attach message data
  $msg->attach(    Type => "text/html",
                   Data => $message,
                   Encoding => "7bit");
[/code]

$message is just a correctly formed HTML document.

Messages sent using this method display perfectly in offline clients such as Outlook, other web based email systems such as Yahoo, my own mail reader at Net my mail.com and other web based email readers like mail2web.

Yet for some reason, although the header information (to, from, subject) is displayed correctly in Hotmail, the message pane is completely blank.

If $msg->attach is used to attach files to the message, these are listed correctly in Hotmail however the message still remains blank.

I have also tried using the following code:

[code]
$msg = MIME::Lite->build(       Type     => "text/html",
                                  Encoding => "7bit",
                                  From    => $from,
                                  Sender  => $from,
                                  To      => $to,
                                  Subject => $subject,
                                  Data    => $message);
[/code]

Again this method works for other clients but the message pane remains blank in Hotmail. I read somewhere a suggestion of calling $msg->scrub before sending the message but this made no difference at all.

Incidentally we also offer the option to send plain text messages using the following code:

[code]
  $msg = MIME::Lite->build(       Type => "text/plain",
                                  From    => $from,
                                  Sender  => $acc_reply_email,
                                  To      => $to,
                                  Cc      => $cc,
                                  Bcc     => $bcc,
                                  ReplyTo => $acc_reply_email,
                                  Subject => $subject,
                                  ReturnPath => $acc_reply_email,
                                  Data    => $message);
[/code]

Plain text messages sent using this method display perfectly in Hotmail (as well as other email clients).

This is getting to be a bit frustrating as every other HTML message from other systems I receive in Hotmail (including some which I’m sure aren’t properly formed) seem to display without any problems yet the messages I’m sending (which I believe to be MIME compliant and properly formed) do not display.

Obviously this is also a problem for the many users there are at Net my mail.com, many of whom I’m sure would like to be able to send HTML messages to Hotmail accounts.

I couldn’t find any reference to this problem in the MIME::Lite POD, nor much useful on Google hence my reason for asking here. If anyone has had this problem and managed to overcome it I’d be very grateful indeed for a solution.

Due to the number of points on offer I’d prefer not to see “use xxx module instead of MIME::Lite” answers. A genuine solution to my problem is what I’m after.

Thanks very much in advance.
0
Comment
Question by:jb69
2 Comments
 
LVL 2

Accepted Solution

by:
mishagale earned 500 total points
ID: 10917543
Could you show us an the complete source of an example message from your program, along with the source of a message which *does* work with hotmail, so we can perhaps see what the difference is? Have you checked the HTML source of the pages hotmail uses to display your e-mails? It may just be that hotmail is providing the HTML from your message, but there is some conflict between the HTML and/or CSS already on the page, and your HTML.
0
 

Author Comment

by:jb69
ID: 10918103
Argh, I don't believe this.

I had a look at the source and as I had seen before Hotmail wasn't displaying any of the readable HTML message. However it was managing to pull the header style information.

I had another look at the HTML being sent and all that was wrong was that I hadn't closed my head tag properly (it was missing the / in the second <head> for some reason). Although Hotmail doesn't display these tags it must have been throwing off the parsing of the message.

Anyway, I fixed that and now it works.

It's funny how every other email reader had no problem with this slight error in HTML but it it made Hotmail fall over completely!

Anyway mishagale, you can have the points for inspiring me to look again at the HTML code displayed. It's not like I need them as I don't come here often :)

Thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question