Connecting Tech Pros Worldwide Help | Site Map

ASP to Word send by ObjSendMail ??

Jerry Yang
Guest
 
Posts: n/a
#1: Aug 27 '08
Hi

I can get the data I need from my DB and show it on screen fine.

One user has asked if I can have an option when the submits his new
data to the DB, instead of it emailing him a plain text or html email,
(as it does now) could it send a copy of the data as a word doc.

Can any one help ??

Server is windows 2003

Thanks
Adrienne Boswell
Guest
 
Posts: n/a
#2: Aug 28 '08

re: ASP to Word send by ObjSendMail ??


Gazing into my crystal ball I observed Jerry Yang <jexxtexx@gmail.com>
writing in news:b692a69c-2866-4f4e-945f-98696c32280b@
56g2000hsm.googlegroups.com:
Quote:
Hi
>
I can get the data I need from my DB and show it on screen fine.
>
One user has asked if I can have an option when the submits his new
data to the DB, instead of it emailing him a plain text or html email,
(as it does now) could it send a copy of the data as a word doc.
>
Can any one help ??
>
Server is windows 2003
>
Thanks
>
Google is your friend. There are plenty of examples. Google for asp
word.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Anthony Jones
Guest
 
Posts: n/a
#3: Aug 28 '08

re: ASP to Word send by ObjSendMail ??


"Jerry Yang" <jexxtexx@gmail.comwrote in message
news:b692a69c-2866-4f4e-945f-98696c32280b@56g2000hsm.googlegroups.com...
Quote:
Hi
>
I can get the data I need from my DB and show it on screen fine.
>
One user has asked if I can have an option when the submits his new
data to the DB, instead of it emailing him a plain text or html email,
(as it does now) could it send a copy of the data as a word doc.
>
Can any one help ??
>
What the user is asking for is far from a trivial change.

As long as you are sending nicely formatted HTML may advice would be to say
to the user "No sorry I can't do that" and see what happens.


--
Anthony Jones - MVP ASP/ASP.NET


Jerry Yang
Guest
 
Posts: n/a
#4: Aug 29 '08

re: ASP to Word send by ObjSendMail ??


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 !!

any other ideas ?

thanks
Anthony Jones
Guest
 
Posts: n/a
#5: Aug 29 '08

re: ASP to Word send by ObjSendMail ??


"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


Jerry Yang
Guest
 
Posts: n/a
#6: Aug 31 '08

re: ASP to Word send by ObjSendMail ??


Cheers that works well :)

Should keep him off my back for a while !!
THANKS
Closed Thread


Similar ASP / Active Server Pages bytes