"Jed" <je****@newsgroups.nospamwrote in message
news:C6**********************************@microsof t.com...
Actually, this is the CDOSYS code I tried.
msg.BodyPart.Charset = "utf-8"
msg.HTMLBody = Message
msg.HTMLBodyPart.Charset = "utf-8"
msg.Send
I accidentally copied the CDONTS code in the last post.
Try this in a VBScript file:-
Option Explicit
Const cdoSendUsingMethod =
"http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoFlushBuffersOnWrite =
"http://schemas.microsoft.com/cdo/configuration/flushbuffersonwrite"
Const cdoSMTPServerPickupDirectory =
"http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory"
Const cdoSendUsingPickup = 1
Dim oMsg : Set oMsg = CreateObject("CDO.Message")
Set oMsg.Configuration = CreateObject("CDO.Configuration")
With oMsg.Configuration.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPickup
.Item(cdoFlushBuffersOnWrite) = True
.Item(cdoSMTPServerPickupDirectory) = "G:\temp\pickup" '*** change this
.Update
End With
oMsg.BodyPart.charset = "UTF-8"
oMsg.From = "Du**@somewhere.com"
oMsg.To = "Bl***@elsewhere.com"
oMsg.Subject = "Testing"
oMsg.HTMLBody = "<html><body>£</body></html>"
oMsg.Send
MsgBox "Done"
Change the pick folder to a temp folder on your macine.
When executed open the resulting eml file in Outlook Express (double click
it). Does the £ appear correctly without other strange characters?
Open the eml file in notepad you should see something like:-
X-Receiver:
Bl***@elsewhere.com
X-Sender:
Du**@somewhere.com
From: <Du**@somewhere.com>
To: <Bl***@elsewhere.com>
Subject: Testing
Date: Sun, 12 Nov 2006 19:46:27 -0000
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0001_01C70693.3DE9F350"
Content-Class: urn:content-classes:message
This is a multi-part message in MIME format.
------=_NextPart_000_0001_01C70693.3DE9F350
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: base64
wqPigqzFkg0K
------=_NextPart_000_0001_01C70693.3DE9F350
Content-Type: text/html;
charset="UTF-8"
Content-Transfer-Encoding: 8bit
<html><body>£</body></html>
------=_NextPart_000_0001_01C70693.3DE9F350--
I deleted some headers for clarity. However you can see that by specifying
UTF-8 on the main message body part before writing anything to the message
has caused it to cascade the UTF-8 encoding to the alternative parts.
What happens you change the code so that the configuration sends using port
25 to your SMTP server and you specify your real email address as the
receiver. Does the email look ok when it arrives in outlook/thunderbird?