"Jerry Yang" <jexxtexx@gmail.comwrote in message
news:dc2019f7-57a5-4f16-b628-7aeee162acd8@d77g2000hsb.googlegroups.com...
Quote:
Hi
I have googled this, but can't seem to find what I'm looking for and
this users is the boss !!
>
So I've got to try and sort something !!
>
|
Since its the boss and not a customer or anyone else important you could
probably get away with using HTML and pretending its a word doc.
Option Explicit
Const cdoSendUsingMethod =
"http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSMTPServer =
"http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPickupDirectory =
"http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory"
Const cdoSMTPServerPort =
"http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSendUsingPickup = 1
Const cdoSendUsingPort = 2
Dim oMsg : Set oMsg = CreateObject("CDO.Message")
Dim oConfig : Set oConfig = CreateObject("CDO.Configuration")
With oConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "mysmtp.myserver.com"
.Item(cdoSMTPServerPort) = 25
.Update
End With
oMsg.From = "Me <me@mymail.myserver.com>"
oMsg.To = "Bloke <boss@mymail.myserver.com>"
oMsg.Subject = "Test"
oMsg.HTMLBody = "<html><body>Hello World</body></html>"
Set oMsg.Configuration = oConfig
Dim oPart : Set oPart = oMsg.Attachments.Add
oPart.ContentMediaType = "text/html;charset=Windows-1252"
oPart.ContentTransferEncoding = "quoted-printable"
oPart.Fields("urn:schemas:mailheader:content-disposition") = "attachment;
filename=""test.doc"""
oPart.Fields.Update
Dim oStream : Set oStream = oPart.GetDecodedContentStream
Dim sDoc : sDoc = "<html><body><h1>This is a Header</h1><p>This is
content</p></body></html>"
oStream.WriteText sDoc
oStream.Flush
oMsg.Send
Ok so the attachment is really HTML but since the filename says its .doc its
word that opens it and word quite happily displays simple HTML.
--
Anthony Jones - MVP ASP/ASP.NET