Home All Groups Group Topic Archive Search About

Malformed email with CDO.Message in ASP



Author
24 Oct 2007 7:43 AM
Jens
Hello,

We have several cases where an email, send with the CDO.Message object
in ASP, is received malformed at the receiver's e-mail address.

>From the ASP code we send a html email with some tables and other html
code in it. When the message is received at the client's email address
there are some characters or text mallformed, each time at another
position in the e-mail. I know for sure that the html code is valid so
that's not the problem.

The script runs from a Windows 2003 webserver edition with IIS 6.0.
Does this problem sounds familiair to anyone?

best regards,
Jens

Author
24 Oct 2007 8:34 AM
Anthony Jones
Show quote
"Jens" <p.meg***@gmail.com> wrote in message
news:1193211807.825287.305070@v23g2000prn.googlegroups.com...
> Hello,
>
> We have several cases where an email, send with the CDO.Message object
> in ASP, is received malformed at the receiver's e-mail address.
>
> >From the ASP code we send a html email with some tables and other html
> code in it. When the message is received at the client's email address
> there are some characters or text mallformed, each time at another
> position in the e-mail. I know for sure that the html code is valid so
> that's not the problem.
>
> The script runs from a Windows 2003 webserver edition with IIS 6.0.
> Does this problem sounds familiair to anyone?
>

It would be useful if you showed your code so that we could see what you are
doing.

How reproducable is it?
If you send the exact same email to several recipients do they each get a
corrupted copy and are the corruptions the same?

Use a pickup folder configuration where the folder specified is a temporary
folder. Open the resulting eml file in outlook express.  Is the content
corrupt?



--
Anthony Jones - MVP ASP/ASP.NET
Author
24 Oct 2007 12:16 PM
Jens
Hello,

We use the code below to send the message.
It seems that some receive the message well, while other mail clients
have problems with it. Also the error is at another place each time,
maybe because the contents of the table are variable and based on the
order details.

    MailContent = "<p>Dear user,<br><br>" &_
    "Please find your order confirmation below: " &_
    "<table border=0 width=658 cellspacing=0 cellpadding=0><tr><td>Table
content</td></tr></table></p>"

    Set cdoConfig = CreateObject("CDO.Configuration")
    With cdoConfig.Fields
        .Item(cdoSendUsingMethod) = cdoSendUsingPort
        .Item(cdoSMTPServer) = "192.168.0.1"
        .Item(cdoSMTPServerport) = "25"
        .Update
    End With

    Set cdoMessage = CreateObject("CDO.Message")
    With cdoMessage
      Set .Configuration = cdoConfig
        .From = "i***@email.com"
        .To = "ï***@email.com"
        .Subject = "Order confirmation"
        .HTMLBody = MailContent
        .Send
    End With


best regards,
Jens
Author
24 Oct 2007 12:42 PM
Anthony Jones
"Jens" <p.meg***@gmail.com> wrote in message
news:1193228217.736243.163440@k35g2000prh.googlegroups.com...
>>>>>>>>>>>>>
Hello,

We use the code below to send the message.
It seems that some receive the message well, while other mail clients
have problems with it. Also the error is at another place each time,
maybe because the contents of the table are variable and based on the
order details.

MailContent = "<p>Dear user,<br><br>" &_
"Please find your order confirmation below: " &_
"<table border=0 width=658 cellspacing=0 cellpadding=0><tr><td>Table
content</td></tr></table></p>"

Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
..Item(cdoSendUsingMethod) = cdoSendUsingPort
..Item(cdoSMTPServer) = "192.168.0.1"
..Item(cdoSMTPServerport) = "25"
..Update
End With

Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
  Set .Configuration = cdoConfig
..From = "i***@email.com"
..To = "ï***@email.com"
..Subject = "Order confirmation"
..HTMLBody = MailContent
..Send
End With
<<<<<<<<<<<<<

Change cdoconfig to:-

With cdoConfig .Fields
    .Item(cdoSendUsingMethod) = cdoSendUsingPickup
    .Item(cdoFlushBuffersOnWrite) = True
    .Item(cdoSMTPServerPickupDirectory) = "c:\temp"
    .Update
End With

Invoke the page and then open the .eml file created in c:\temp in a outlook
express.  Does it look ok?  Open it with notepad.  Post here the headers at
the top the file and the headers preceeding the HTML body part.  I'm
especially interested in Content -Type, Char-set, Transfer-Encoding.



--
Anthony Jones - MVP ASP/ASP.NET
Author
25 Oct 2007 7:36 AM
Jens
>
> Invoke the page and then open the .eml file created in c:\temp in a outlook
> express.  Does it look ok?  Open it with notepad.  Post here the headers at
> the top the file and the headers preceeding the HTML body part.  I'm
> especially interested in Content -Type, Char-set, Transfer-Encoding.
>
> --
> Anthony Jones - MVP ASP/ASP.NET


Hello Anthony,

Thanks for your help so far.
I've changed the fields as you supposed. When I open the email in
Outlook Express it seems okay there.

As far as I can see the problems only occur at some email addresses,
because when I send the same email to different addresses it's
received good at some and mallformed at some other.

Please find some headers here:
   MIME-Version: 1.0
   Content-Type: multipart/mixed; boundary="----
=_NextPart_000_009E_01C816E9.523A6990"
   X-Mailer: Microsoft CDO for Windows 2000
   X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2929
   Content-Class: urn:content-classes:message

   This is a multi-part message in MIME format.

   ------=_NextPart_000_009E_01C816E9.523A6990
   Content-Type: multipart/alternative;
    boundary="----=_NextPart_001_009F_01C816E9.523A6990"

   ------=_NextPart_001_009F_01C816E9.523A6990
   Content-Type: text/plain;
    charset="iso-8859-1"
   Content-Transfer-Encoding: quoted-printable


I hope you can see anything strange here?
regards,
Jens
Author
25 Oct 2007 8:32 AM
Anthony Jones
Show quote
"Jens" <p.meg***@gmail.com> wrote in message
news:1193297781.471805.45780@k35g2000prh.googlegroups.com...
> >
> > Invoke the page and then open the .eml file created in c:\temp in a
outlook
> > express.  Does it look ok?  Open it with notepad.  Post here the headers
at
> > the top the file and the headers preceeding the HTML body part.  I'm
> > especially interested in Content -Type, Char-set, Transfer-Encoding.
> >
> > --
> > Anthony Jones - MVP ASP/ASP.NET
>
>
> Hello Anthony,
>
> Thanks for your help so far.
> I've changed the fields as you supposed. When I open the email in
> Outlook Express it seems okay there.
>
> As far as I can see the problems only occur at some email addresses,
> because when I send the same email to different addresses it's
> received good at some and mallformed at some other.
>
> Please find some headers here:
>    MIME-Version: 1.0
>    Content-Type: multipart/mixed; boundary="----
> =_NextPart_000_009E_01C816E9.523A6990"
>    X-Mailer: Microsoft CDO for Windows 2000
>    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2929
>    Content-Class: urn:content-classes:message
>
>    This is a multi-part message in MIME format.
>
>    ------=_NextPart_000_009E_01C816E9.523A6990
>    Content-Type: multipart/alternative;
> boundary="----=_NextPart_001_009F_01C816E9.523A6990"
>
>    ------=_NextPart_001_009F_01C816E9.523A6990
>    Content-Type: text/plain;
> charset="iso-8859-1"
>    Content-Transfer-Encoding: quoted-printable
>

There should be another part with the Content-Type:text/html  further down
the email can I see the headers for that?  What you've posted above looks
fine.


--
Anthony Jones - MVP ASP/ASP.NET
Author
25 Oct 2007 10:54 AM
Jens
Show quote
On 25 okt, 10:32, "Anthony Jones" <A***@yadayadayada.com> wrote:
> "Jens" <p.meg***@gmail.com> wrote in message
>
> news:1193297781.471805.45780@k35g2000prh.googlegroups.com...
>
>
>
>
>
>
>
> > > Invoke the page and then open the .eml file created in c:\temp in a
> outlook
> > > express.  Does it look ok?  Open it with notepad.  Post here the headers
> at
> > > the top the file and the headers preceeding the HTML body part.  I'm
> > > especially interested in Content -Type, Char-set, Transfer-Encoding.
>
> > > --
> > > Anthony Jones - MVP ASP/ASP.NET
>
> > Hello Anthony,
>
> > Thanks for your help so far.
> > I've changed the fields as you supposed. When I open the email in
> > Outlook Express it seems okay there.
>
> > As far as I can see the problems only occur at some email addresses,
> > because when I send the same email to different addresses it's
> > received good at some and mallformed at some other.
>
> > Please find some headers here:
> >    MIME-Version: 1.0
> >    Content-Type: multipart/mixed; boundary="----
> > =_NextPart_000_009E_01C816E9.523A6990"
> >    X-Mailer: Microsoft CDO for Windows 2000
> >    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2929
> >    Content-Class: urn:content-classes:message
>
> >    This is a multi-part message in MIME format.
>
> >    ------=_NextPart_000_009E_01C816E9.523A6990
> >    Content-Type: multipart/alternative;
> > boundary="----=_NextPart_001_009F_01C816E9.523A6990"
>
> >    ------=_NextPart_001_009F_01C816E9.523A6990
> >    Content-Type: text/plain;
> > charset="iso-8859-1"
> >    Content-Transfer-Encoding: quoted-printable
>
> There should be another part with the Content-Type:text/html  further down
> the email can I see the headers for that?  What you've posted above looks
> fine.
>
> --
> Anthony Jones - MVP ASP/ASP.NET- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -


Anthony,
Yes there are more headers, see below:

------=_NextPart_001_009F_01C816E9.523A6990
Content-Type: text/html
Content-Transfer-Encoding: 8bit

<html><head><meta HTTP-EQUIV="Content-Type" CONTENT="text/
html;charset=iso-8859-1"><title>Uw persoonlijke offerte per e-mail</
title></head><body BGColor="#FFFFFF" Text="#000000"><p>...</p></body></
html>
------=_NextPart_001_009F_01C816E9.523A6990--

------=_NextPart_000_009E_01C816E9.523A6990
Content-Type: application/octet-stream;
    name="Dienstenwijzer.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
    filename="Dienstenwijzer.pdf"
Author
25 Oct 2007 12:13 PM
Anthony Jones
Show quote
"Jens" <p.meg***@gmail.com> wrote in message
news:1193309680.498276.232910@57g2000hsv.googlegroups.com...
>
> Anthony,
> Yes there are more headers, see below:
>
> ------=_NextPart_001_009F_01C816E9.523A6990
> Content-Type: text/html
> Content-Transfer-Encoding: 8bit
>
> <html><head><meta HTTP-EQUIV="Content-Type" CONTENT="text/
> html;charset=iso-8859-1"><title>Uw persoonlijke offerte per e-mail</
> title></head><body BGColor="#FFFFFF" Text="#000000"><p>...</p></body></
> html>
> ------=_NextPart_001_009F_01C816E9.523A6990--
>
> ------=_NextPart_000_009E_01C816E9.523A6990
> Content-Type: application/octet-stream;
> name="Dienstenwijzer.pdf"
> Content-Transfer-Encoding: base64
> Content-Disposition: attachment;
> filename="Dienstenwijzer.pdf"
>


Its the 8bit transfer encoding on the html part which is causing the
problem.  It should be quoted-printable like the plain text alternative
part.  I've come acroess this before on Win 2003 machines where CDO chooses
8bit encoding despite it being an in appropriate encoding for sending via
SMTP.

Trying adding this line before sending:-

..HTMLBodyPart.ContentTransferEncoding = "quoted-printable"

--
Anthony Jones - MVP ASP/ASP.NET
Author
25 Oct 2007 2:57 PM
Jens
Hello Anthony,

Really great, it seems that this solves the problem,
Thanks for you help!
Jens

AddThis Social Bookmark Button