Connecting Tech Pros Worldwide Help | Site Map

ASP to Word send by ObjSendMail ??

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 27th, 2008, 10:55 PM
Jerry Yang
Guest
 
Posts: n/a
Default ASP to Word send by ObjSendMail ??

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

  #2  
Old August 28th, 2008, 08:55 AM
Adrienne Boswell
Guest
 
Posts: n/a
Default 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

  #3  
Old August 28th, 2008, 09:05 AM
Anthony Jones
Guest
 
Posts: n/a
Default 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


  #4  
Old August 29th, 2008, 05:25 PM
Jerry Yang
Guest
 
Posts: n/a
Default 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
  #5  
Old August 29th, 2008, 06:45 PM
Anthony Jones
Guest
 
Posts: n/a
Default 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


  #6  
Old August 31st, 2008, 02:35 PM
Jerry Yang
Guest
 
Posts: n/a
Default Re: ASP to Word send by ObjSendMail ??

Cheers that works well :)

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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.