Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP to Word send by ObjSendMail ??

Reply
Thread Tools

ASP to Word send by ObjSendMail ??

 
 
Jerry Yang
Guest
Posts: n/a
 
      08-27-2008
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
 
Reply With Quote
 
 
 
 
Adrienne Boswell
Guest
Posts: n/a
 
      08-28-2008
Gazing into my crystal ball I observed Jerry Yang <(E-Mail Removed)>
writing in news:b692a69c-2866-4f4e-945f-98696c32280b@
56g2000hsm.googlegroups.com:

> 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

 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      08-28-2008
"Jerry Yang" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
Jerry Yang
Guest
Posts: n/a
 
      08-29-2008
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
 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      08-29-2008
"Jerry Yang" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 <(E-Mail Removed)>"
oMsg.To = "Bloke <(E-Mail Removed)>"
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


 
Reply With Quote
 
Jerry Yang
Guest
Posts: n/a
 
      08-31-2008
Cheers that works well

Should keep him off my back for a while !!
THANKS
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail.SmtpMail.Send won't send to one of my addresses Nathan Sokalski ASP .Net 3 11-23-2005 09:25 PM
XML from Word -- formerly Create pdf from existing Word doc (asp.net) Sharon ASP .Net 0 07-27-2005 02:07 AM
Pre-Send Request Headers, Pre-Send Request Content =?Utf-8?B?S2V2aW4gQnVydG9u?= ASP .Net 0 12-31-2004 06:29 PM
Does Socket.send send all bytes? Chris Reay Ruby 2 11-04-2003 08:22 PM
How to send attachments in Microsoft Works Word to Microsoft Word Lynne Watkins Computer Support 1 09-04-2003 08:05 AM



Advertisments