N
nathan _
I have a page which sends out email, the content of which is often
pasted from a MS Word document. When this message is received in Outlook
the character coding is out and doesn't display properly:
Following is an example of what does not display correctly:
*********************************************************
Const cdoFlushBuffersOnWrite =
"http://schemas.microsoft.com/cdo/configuration/flushbuffersonwrite"
Const cdoSMTPServerPickupDirectory =
"http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirector
y"
Dim oMsg : Set oMsg = CreateObject("CDO.Message")
Set oMsg.Configuration = CreateObject("CDO.Configuration")
strSmtpServer = "server ip here"
strUser = "username here"
strPassword = "password here"
With oMsg.Configuration.Fields
..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
strSmtpServer
..Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")
= 1
..Item("http://schemas.microsoft.com/cdo/configuration/sendusername") =
strUser
..Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
strPassword
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
25
..Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") =
False
..Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontime
out") = 60
'.Item(cdoFlushBuffersOnWrite) = True
'.Item(cdoSMTPServerPickupDirectory) = "c:\temp\pickup" '*** change this
..Update
End With
oMsg.BodyPart.charset = "UTF-8"
oMsg.From = "address goes here"
oMsg.To = "address goes here"
oMsg.Subject = "Testing"
oMsg.HTMLBody = "<TABLE style=""BORDER-COLLAPSE: collapse;
mso-yfti-tbllook: 480; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt""
class=MsoTableGrid border=0 cellSpacing=0 cellPadding=0><TBODY><TR
style=""mso-yfti-irow: 0; mso-yfti-firstrow: yes"">" & _
"<TD style=""BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0;
PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt;
WIDTH: 166.55pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0;
BORDER-RIGHT: #f0f0f0; PADDING-TOP: 0cm"" vAlign=top width=222>" & _
"<P style=""TEXT-ALIGN: left; MARGIN: 0cm 0cm 12pt; tab-stops: 54.0pt
right 467.7pt"" class=MsoNormal align=left><SPAN style=""FONT-SIZE:
10pt; mso-bidi-font-family: Arial; mso-bidi-font-weight: bold""><FONT
face=Arial>“<B>Admission
Document</B>”<o></o></FONT></SPAN></P></TD>" & _
"<TD style=""BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0;
PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt;
WIDTH: 243.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT:
#f0f0f0; PADDING-TOP: 0cm"" vAlign=top width=325>" & _
"<P style=""TEXT-ALIGN: left; MARGIN: 0cm 0cm 12pt; tab-stops: 54.0pt
right 467.7pt"" class=MsoNormal align=left><SPAN style=""FONT-SIZE:
10pt; mso-bidi-font-family: Arial""><FONT face=Arial>the Company’s AIM
admission document dated 15 September
2006;<o></o></FONT></SPAN></P></TD></TR>" & _
"<TR style=""mso-yfti-irow: 3"">" & _
"<TD style=""BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0;
PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt;
WIDTH: 166.55pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0;
BORDER-RIGHT: #f0f0f0; PADDING-TOP: 0cm"" vAlign=top width=222>" & _
"<P style=""MARGIN: 0cm 0cm 12pt; tab-stops: 54.0pt right 467.7pt""
class=MsoNormal><SPAN style=""FONT-SIZE: 10pt; mso-bidi-font-family:
Arial""><FONT face=Arial>‘‘<B style=""mso-bidi-font-weight:
normal"">certificated</B>’’ or ‘‘<B style=""mso-bidi-font-weight:
normal"">in certificated form</B>”<SPAN style=""mso-bidi-font-weight:
bold""><o></o></SPAN></FONT></SPAN></P></TD>" & _
"<TD style=""BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0;
PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt;
WIDTH: 243.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT:
#f0f0f0; PADDING-TOP: 0cm"" vAlign=top width=325>" & _
"<P style=""MARGIN: 0cm 0cm 12pt; tab-stops: 54.0pt right 467.7pt""
class=MsoNormal><SPAN style=""FONT-SIZE: 10pt; mso-bidi-font-family:
Arial""><FONT face=Arial>not in uncertificated form;
<o></o></FONT></SPAN></P></TD></TR></tbody></table>"
oMsg.Send
*********************************************************
If i run the above from a VBS file the email displays fine and if i
export that message out to an eml file from the vbs it displays fine
too.
header for eml is:
---------------------------------------------------------
X-Receiver: (e-mail address removed)
X-Sender: (e-mail address removed)
thread-index: AcpMy9QPm8736OfKSX6zKvmrtEmxgw==
Thread-Topic: Testing
From: <[email protected]>
To: <[email protected]>
Subject: Testing
Date: Wed, 14 Oct 2009 13:42:45 +0100
Message-ID: <9A2C7BC5F87341878A421C463FE60A6B@nathanlaptop>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0000_01CA4CD4.35D5C420"
X-Mailer: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18005
This is a multi-part message in MIME format.
------=_NextPart_000_0000_01CA4CD4.35D5C420
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: base64
** CONTENT REMOVED **
------=_NextPart_000_0000_01CA4CD4.35D5C420
Content-Type: text/html;
charset="UTF-8"
Content-Transfer-Encoding: 8bit
pasted from a MS Word document. When this message is received in Outlook
the character coding is out and doesn't display properly:
Following is an example of what does not display correctly:
*********************************************************
Const cdoFlushBuffersOnWrite =
"http://schemas.microsoft.com/cdo/configuration/flushbuffersonwrite"
Const cdoSMTPServerPickupDirectory =
"http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirector
y"
Dim oMsg : Set oMsg = CreateObject("CDO.Message")
Set oMsg.Configuration = CreateObject("CDO.Configuration")
strSmtpServer = "server ip here"
strUser = "username here"
strPassword = "password here"
With oMsg.Configuration.Fields
..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
strSmtpServer
..Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")
= 1
..Item("http://schemas.microsoft.com/cdo/configuration/sendusername") =
strUser
..Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
strPassword
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
25
..Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") =
False
..Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontime
out") = 60
'.Item(cdoFlushBuffersOnWrite) = True
'.Item(cdoSMTPServerPickupDirectory) = "c:\temp\pickup" '*** change this
..Update
End With
oMsg.BodyPart.charset = "UTF-8"
oMsg.From = "address goes here"
oMsg.To = "address goes here"
oMsg.Subject = "Testing"
oMsg.HTMLBody = "<TABLE style=""BORDER-COLLAPSE: collapse;
mso-yfti-tbllook: 480; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt""
class=MsoTableGrid border=0 cellSpacing=0 cellPadding=0><TBODY><TR
style=""mso-yfti-irow: 0; mso-yfti-firstrow: yes"">" & _
"<TD style=""BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0;
PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt;
WIDTH: 166.55pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0;
BORDER-RIGHT: #f0f0f0; PADDING-TOP: 0cm"" vAlign=top width=222>" & _
"<P style=""TEXT-ALIGN: left; MARGIN: 0cm 0cm 12pt; tab-stops: 54.0pt
right 467.7pt"" class=MsoNormal align=left><SPAN style=""FONT-SIZE:
10pt; mso-bidi-font-family: Arial; mso-bidi-font-weight: bold""><FONT
face=Arial>“<B>Admission
Document</B>”<o></o></FONT></SPAN></P></TD>" & _
"<TD style=""BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0;
PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt;
WIDTH: 243.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT:
#f0f0f0; PADDING-TOP: 0cm"" vAlign=top width=325>" & _
"<P style=""TEXT-ALIGN: left; MARGIN: 0cm 0cm 12pt; tab-stops: 54.0pt
right 467.7pt"" class=MsoNormal align=left><SPAN style=""FONT-SIZE:
10pt; mso-bidi-font-family: Arial""><FONT face=Arial>the Company’s AIM
admission document dated 15 September
2006;<o></o></FONT></SPAN></P></TD></TR>" & _
"<TR style=""mso-yfti-irow: 3"">" & _
"<TD style=""BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0;
PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt;
WIDTH: 166.55pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0;
BORDER-RIGHT: #f0f0f0; PADDING-TOP: 0cm"" vAlign=top width=222>" & _
"<P style=""MARGIN: 0cm 0cm 12pt; tab-stops: 54.0pt right 467.7pt""
class=MsoNormal><SPAN style=""FONT-SIZE: 10pt; mso-bidi-font-family:
Arial""><FONT face=Arial>‘‘<B style=""mso-bidi-font-weight:
normal"">certificated</B>’’ or ‘‘<B style=""mso-bidi-font-weight:
normal"">in certificated form</B>”<SPAN style=""mso-bidi-font-weight:
bold""><o></o></SPAN></FONT></SPAN></P></TD>" & _
"<TD style=""BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0;
PADDING-BOTTOM: 0cm; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt;
WIDTH: 243.9pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT:
#f0f0f0; PADDING-TOP: 0cm"" vAlign=top width=325>" & _
"<P style=""MARGIN: 0cm 0cm 12pt; tab-stops: 54.0pt right 467.7pt""
class=MsoNormal><SPAN style=""FONT-SIZE: 10pt; mso-bidi-font-family:
Arial""><FONT face=Arial>not in uncertificated form;
<o></o></FONT></SPAN></P></TD></TR></tbody></table>"
oMsg.Send
*********************************************************
If i run the above from a VBS file the email displays fine and if i
export that message out to an eml file from the vbs it displays fine
too.
header for eml is:
---------------------------------------------------------
X-Receiver: (e-mail address removed)
X-Sender: (e-mail address removed)
thread-index: AcpMy9QPm8736OfKSX6zKvmrtEmxgw==
Thread-Topic: Testing
From: <[email protected]>
To: <[email protected]>
Subject: Testing
Date: Wed, 14 Oct 2009 13:42:45 +0100
Message-ID: <9A2C7BC5F87341878A421C463FE60A6B@nathanlaptop>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0000_01CA4CD4.35D5C420"
X-Mailer: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18005
This is a multi-part message in MIME format.
------=_NextPart_000_0000_01CA4CD4.35D5C420
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: base64
** CONTENT REMOVED **
------=_NextPart_000_0000_01CA4CD4.35D5C420
Content-Type: text/html;
charset="UTF-8"
Content-Transfer-Encoding: 8bit