Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: CDONTS problem : HTML code scrambled


Message #1 by "Tim Van Bruwaene" <tvbruwae@p...> on Thu, 30 May 2002 15:38:15
Hi

I'm using CDONTS to send email from an ASP page. The message is intended 
to be in HTML format instead of plain text. However, although it works 
fine for over 50 people, one person's computer seems to scramble the HTML 
code in the mail. This seems strange to me, in the first place because ASP 
is supposed to handle all actions on the server... 

This is the code that is causing the problem :
-----------------------------------------------------------

'Define mail object
Dim objMail
'Create mail object
Set objMail = Server.CreateObject ("CDONTS.NewMail")
'Set a Reply-To-address
objMail.From = "MyAddress@H..."
'Mail Subject
objMail.Subject = "New Database Entry"
'Send mail to supervisor
objMail.To = CRFMailAddress
'Send a copy to the user who submits the data
objMail.CC = User
'Body message type : HTML
objMail.BodyFormat = 0
'Mail type : MIME
objMail.MailFormat = 0
'Body message text

objMail.Body = ("A new entry has been made on " + FormatDateTime(Now) + ". 
The user who submitted it is <A HREF=""mailto:" + User + """>" + UserName 
+ "</A>.<P><U>Details : </U></P><P><TABLE width=""50%"" border=""4"" 
bordercolor=""#BBD9F7"" 
bordercolordark=""#08297b""><TR><TD><B>Configuration ID</B></TD><TD>" + 
request.Form ("Config") + "</TD></TR><TR><TD><B>User Name</B></TD><TD>" + 
request.Form ("SUserLast") + "</TD></TR><TR><TD><B>User First 
Name</B></TD><TD>" + request.Form ("SUserFirst") 
+ "</TD></TR><TR><TD><B>User ID</B></TD><TD>" + request.Form ("SUserID") 
+ "</TD></TR></TABLE></P><P>Please consult the attachments for further 
details.")

'Attachment processing
Dim FString, FArray, FName
'Retrieve file list
FString = Request.Form("Files")
'Get file names from file string
FArray = Split (FString, ";")
for i=0 to (UBound(FArray)-1)        
  if FArray(i) <>  "" then
    'Define file to be sent
    FArray(i) = FolderName + FArray(i)
    'Give user-friendly name to file attachment
    FName = right (FArray(i), (len(FArray(i)) - instr (FArray(i), " CRF_") 
+ 1))
    'Add attachment
    objMail.AttachFile FArray(i), FName
  end if
next

'Send mail
objMail.Send
Set objMail = nothing
-----------------------------------------------------------------

All users that use this asp form receive an HTML email with the table, 
clickable username and attachments, except for this one... He gets the 
following text :

"... submitted it is John Doe <mailto:john.doe@h...>"

and no attachments are included. So this looks like the code is cut off in 
the middle of the body text. CDONTS does send mail from the server, so I 
don't understand why a certain client configuration could give problems 
with this script, but still it's very annoying. Does someone have a clue 
what I could check on the client to solve this?

Thanks
Message #2 by "Siegfried Weber" <sweber@c...> on Thu, 30 May 2002 18:21:50 +0200
If I'd be you I'd check the client. Sounds like there is the problem
located or maybe a mail server this particular client uses is the
culprit.

<Siegfried />

> -----Original Message-----
> From: Tim Van Bruwaene [mailto:tvbruwae@p...]
> Sent: Thursday, May 30, 2002 5:38 PM
> To: ASP CDO
> Subject: [asp_cdo] CDONTS problem : HTML code scrambled
>
> Hi
>
> I'm using CDONTS to send email from an ASP page. The message is
intended
> to be in HTML format instead of plain text. However, although it works
> fine for over 50 people, one person's computer seems to scramble the
HTML
> code in the mail. This seems strange to me, in the first place because
ASP
> is supposed to handle all actions on the server...
>
> This is the code that is causing the problem :
> -----------------------------------------------------------
>
> 'Define mail object
> Dim objMail
> 'Create mail object
> Set objMail =3D Server.CreateObject ("CDONTS.NewMail")
> 'Set a Reply-To-address
> objMail.From =3D "MyAddress@H..."
> 'Mail Subject
> objMail.Subject =3D "New Database Entry"
> 'Send mail to supervisor
> objMail.To =3D CRFMailAddress
> 'Send a copy to the user who submits the data
> objMail.CC =3D User
> 'Body message type : HTML
> objMail.BodyFormat =3D 0
> 'Mail type : MIME
> objMail.MailFormat =3D 0
> 'Body message text
>
> objMail.Body =3D ("A new entry has been made on " + 
FormatDateTime(Now)
+ ".
> The user who submitted it is <A HREF=3D""mailto:" + User + """>" +
UserName
> + "</A>.<P><U>Details : </U></P><P><TABLE width=3D""50%"" 
border=3D""4""
> bordercolor=3D""#BBD9F7""
> bordercolordark=3D""#08297b""><TR><TD><B>Configuration 
ID</B></TD><TD>"
+
> request.Form ("Config") + "</TD></TR><TR><TD><B>User
Name</B></TD><TD>" +
> request.Form ("SUserLast") + "</TD></TR><TR><TD><B>User First
> Name</B></TD><TD>" + request.Form ("SUserFirst")
> + "</TD></TR><TR><TD><B>User ID</B></TD><TD>" + request.Form
("SUserID")
> + "</TD></TR></TABLE></P><P>Please consult the attachments for further
> details.")
>
> 'Attachment processing
> Dim FString, FArray, FName
> 'Retrieve file list
> FString =3D Request.Form("Files")
> 'Get file names from file string
> FArray =3D Split (FString, ";")
> for i=3D0 to (UBound(FArray)-1)
>   if FArray(i) <>  "" then
>     'Define file to be sent
>     FArray(i) =3D FolderName + FArray(i)
>     'Give user-friendly name to file attachment
>     FName =3D right (FArray(i), (len(FArray(i)) - instr (FArray(i), "
CRF_")
> + 1))
>     'Add attachment
>     objMail.AttachFile FArray(i), FName
>   end if
> next
>
> 'Send mail
> objMail.Send
> Set objMail =3D nothing
> -----------------------------------------------------------------
>
> All users that use this asp form receive an HTML email with the table,
> clickable username and attachments, except for this one... He gets the
> following text :
>
> "... submitted it is John Doe <mailto:john.doe@h...>"
>
> and no attachments are included. So this looks like the code is cut
off in
> the middle of the body text. CDONTS does send mail from the server, so
I
> don't understand why a certain client configuration could give
problems
> with this script, but still it's very annoying. Does someone have a
clue
> what I could check on the client to solve this?
>
> Thanks
Message #3 by "Tim Van Bruwaene" <tvbruwae@p...> on Fri, 31 May 2002 09:21:59
I already reinstalled Internet Explorer 6, Outlook 2000 and Outlook 
Express 5, without any improvement. The mail itself is sent to a central 
mail server through SMTP on the webserver, so there shouldn't be any 
difference between sent mails from different clients, I guess...

  Return to Index