Malformed email with CDO.Message in ASP

Malformed email with CDO.Message in ASP

am 24.10.2007 09:43:27 von 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

Re: Malformed email with CDO.Message in ASP

am 24.10.2007 10:34:40 von Anthony Jones

"Jens" 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

Re: Malformed email with CDO.Message in ASP

am 24.10.2007 14:16:57 von 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 =3D "

Dear user,

" &_
"Please find your order confirmation below: " &_
"

Tab=
le
content

"

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

Set cdoMessage =3D CreateObject("CDO.Message")
With cdoMessage
Set .Configuration =3D cdoConfig
.From =3D "info@email.com"
.To =3D "=EFnfo@email.com"
.Subject =3D "Order confirmation"
.HTMLBody =3D MailContent
.Send
End With


best regards,
Jens

Re: Malformed email with CDO.Message in ASP

am 24.10.2007 14:42:01 von Anthony Jones

"Jens" 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 = "

Dear user,

" &_
"Please find your order confirmation below: " &_
"

Table
content

"

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 = "info@email.com"
..To = "ïnfo@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

Re: Malformed email with CDO.Message in ASP

am 25.10.2007 09:36:21 von 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

Re: Malformed email with CDO.Message in ASP

am 25.10.2007 10:32:59 von Anthony Jones

"Jens" 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

Re: Malformed email with CDO.Message in ASP

am 25.10.2007 14:13:41 von Anthony Jones

"Jens" 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
>
> Uw persoonlijke offerte per e-mail</<br /> > title></head><body BGColor="#FFFFFF" Text="#000000"><p>...</p></body></<br /> > html><br /> > ------=_NextPart_001_009F_01C816E9.523A6990--<br /> ><br /> > ------=_NextPart_000_009E_01C816E9.523A6990<br /> > Content-Type: application/octet-stream;<br /> > name="Dienstenwijzer.pdf"<br /> > Content-Transfer-Encoding: base64<br /> > Content-Disposition: attachment;<br /> > filename="Dienstenwijzer.pdf"<br /> ><br /> <br /> <br /> Its the 8bit transfer encoding on the html part which is causing the<br /> problem. It should be quoted-printable like the plain text alternative<br /> part. I've come acroess this before on Win 2003 machines where CDO chooses<br /> 8bit encoding despite it being an in appropriate encoding for sending via<br /> SMTP.<br /> <br /> Trying adding this line before sending:-<br /> <br /> ..HTMLBodyPart.ContentTransferEncoding = "quoted-printable"<br /> <br /> -- <br /> Anthony Jones - MVP ASP/ASP.NET</p> </article> <article> <h2>Re: Malformed email with CDO.Message in ASP</h2><span>am 25.10.2007 16:57:06 von Jens</span> <p>Hello Anthony,<br /> <br /> Really great, it seems that this solves the problem,<br /> Thanks for you help!<br /> Jens</p> </article> <footer> <a href="/">Index</a> | <a href="/impressum.php">Impressum</a> | <a href="/datenschutz.php">Datenschutz</a> | <a href="https://www.xodox.de/">XODOX</a> </footer> </main> </body> </html>