Malformed email with CDO.Message in ASP

J

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
 
A

Anthony Jones

Jens said:
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.

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?
 
J

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 = "(e-mail address removed)"
.To = "ï[email protected]"
.Subject = "Order confirmation"
.HTMLBody = MailContent
.Send
End With


best regards,
Jens
 
A

Anthony Jones

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 = "(e-mail address removed)"
..To = "ï[email protected]"
..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.
 
J

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.


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
 
A

Anthony Jones

Jens said:
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.
 
J

Jens

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,
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"
 
A

Anthony Jones

Jens said:
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"
 
J

Jens

Hello Anthony,

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top