Problem sending HTML messages with MIME::Lite to Hotmail

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.
jb69Asked:
Who is Participating?
 
mishagaleConnect With a Mentor Commented:
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
 
jb69Author Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.