Solved

Problem sending HTML messages with MIME::Lite to Hotmail

Posted on 2004-04-26
2
549 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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now