"Jed" <je****@newsgro ups.nospamwrote in message
news:C6******** *************** ***********@mic rosoft.com...
Actually, this is the CDOSYS code I tried.
msg.BodyPart.Ch arset = "utf-8"
msg.HTMLBody = Message
msg.HTMLBodyPar t.Charset = "utf-8"
msg.Send
I accidentally copied the CDONTS code in the last post.
Try this in a VBScript file:-
Option Explicit
Const cdoSendUsingMet hod =
"http://schemas.microso ft.com/cdo/configuration/sendusing"
Const cdoFlushBuffers OnWrite =
"http://schemas.microso ft.com/cdo/configuration/flushbuffersonw rite"
Const cdoSMTPServerPi ckupDirectory =
"http://schemas.microso ft.com/cdo/configuration/smtpserverpicku pdirectory"
Const cdoSendUsingPic kup = 1
Dim oMsg : Set oMsg = CreateObject("C DO.Message")
Set oMsg.Configurat ion = CreateObject("C DO.Configuratio n")
With oMsg.Configurat ion.Fields
.Item(cdoSendUs ingMethod) = cdoSendUsingPic kup
.Item(cdoFlushB uffersOnWrite) = True
.Item(cdoSMTPSe rverPickupDirec tory) = "G:\temp\pickup " '*** change this
.Update
End With
oMsg.BodyPart.c harset = "UTF-8"
oMsg.From = "Du**@somewhere .com"
oMsg.To = "Bl***@elsewher e.com"
oMsg.Subject = "Testing"
oMsg.HTMLBody = "<html><bod y>£</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***@elsewher e.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.3 DE9F350"
Content-Class: urn:content-classes:message
This is a multi-part message in MIME format.
------=_NextPart_000_ 0001_01C70693.3 DE9F350
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: base64
wqPigqzFkg0K
------=_NextPart_000_ 0001_01C70693.3 DE9F350
Content-Type: text/html;
charset="UTF-8"
Content-Transfer-Encoding: 8bit
<html><body>£ </body></html>
------=_NextPart_000_ 0001_01C70693.3 DE9F350--
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?