allows,fill,send,Outlook,message,from,script,
Quick Search for:  in language:    
allows,fill,send,Outlook,message,from,script,
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 132,008 lines
 Jobs: 161 postings

 
Sponsored by:

 

You are in:

 
Login


 

 


Latest Code Ticker for ASP/ VbScript.
List Records
By Edito P. Aspra Jr. on 8/26


DSN Less Connection to SQL Server Database
By alpesh shah on 8/26


Click here to see a screenshot of this code!Database Driven Select Menu w/ default select
By Jayson Starkey on 8/26

(Screen Shot)

A Simple guestbook in ASP
By Matthew Meadows on 8/25


Simple GuestBook or Feedback Page Requiring No Database Implementation
By Ken Alabi on 8/25


if i remember, this is a M. Harris code sample
By ask on 8/24


MTS Registration Script
By Igor Krupitsky on 8/23


Click here to see a screenshot of this code!Creating Windows Users with ASP and ADSI
By jamespwalters on 8/23

(Screen Shot)

News Poster (Advanced)
By Martin Kilbryde on 8/22


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Send Outlook message from script

Print
Email
 
VB icon
Submitted on: 2/3/2001 12:27:13 AM
By: T Runstein 
Level: Beginner
User Rating: By 8 Users
Compatibility:ASP (Active Server Pages), VbScript (browser/client side)

Users have accessed this code 15564 times.
 
(About the author)
 
     This allows you to fill out and send an Outlook message from script. Uncomment 2 lines to create a sub that can be included in a larger script. Great for admins who routinely send reports. 'T Runstein
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    '**************************************
    ' Name: Send Outlook message from script
    '     
    ' Description:This allows you to fill ou
    '     t and send an Outlook message from scrip
    '     t. Uncomment 2 lines to create a sub tha
    '     t can be included in a larger script. Gr
    '     eat for admins who routinely send report
    '     s. 'T Runstein
    ' By: T Runstein
    '
    ' Inputs:The script, as shown, is all ha
    '     rdcoded, but you could easily call "inpu
    '     tbox", or read inputs off a form to fill
    '     in the items. If you need help adapting 
    '     this to your needs, let me know - I'm ha
    '     ppy to help you customize it.
    '
    ' Returns:You can choose to preview by u
    '     sing the .display, or send without previ
    '     ew by using .send
    '
    ' Assumes:As with all .vbs scripts, you 
    '     must have the scripting runtime. You als
    '     o need Outlook installed.
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/xq/ASP/txtCode
    '     Id.6480/lngWId.4/qx/vb/scripts/ShowCode.
    '     htm    'for details.    '**************************************
    
    'Uncomment the sub and 
    'end sub lines to use this in a program.
    '     
    'Leaving these commented will allow you 
    '     
    'to run this as a standalone script
    'sub SendAttach() 
    'Open mail, adress, attach report
    Dim objOutlk	'Outlook
    Dim objMail	'Email item
    Dim strMsg
    Const olMailItem = 0
    'Create a new message
    	Set objOutlk = createobject("Outlook.Application")
    	Set objMail = objOutlk.createitem(olMailItem)
    	objMail.To = "t_a_r@email.msn.com"
    	objMail.cc = "" 'Enter an address here To include a carbon copy; bcc is For blind carbon copy's
    'Set up Subject Line
    	objMail.subject = "I saw your code On Planet Source Code on " & cstr(month(now)) & "/" & cstr(day(now)) & "/" & cstr(year(now))
    'Add the body
    	
    	strMsg = "Your code rocks!" & vbcrlf
    	strMsg = strMsg & "I voted and gave you an excellent rating!"
    'To add an attachment, use:
    	'objMail.attachments.add("C:\MyAttachmentFile.txt")
    	objMail.body = strMsg
    	objMail.display 'Use this To display before sending, otherwise call objMail.Send to send without reviewing
    'Clean up
    Set objMail = nothing
    Set objOutlk = nothing
    'end sub


Other 2 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
2/16/2001 4:03:00 AM:Jos Krause
When I run your script I got an error 
stating I was using an invalid calling 
method to the CreateObject. I got rid 
of that error by using: 
Server.CreateObject (but I guess this 
beats the point to your script) Anyway 
I recieve this error as a follow 
up:
Error Type:
Server object, ASP 
0177 (0x800401F3)
Invalid ProgID. For 
additional information specific to this 
message please visit the Microsoft 
Online Support site located at: 
http://www.microsoft.com/contentredirect
.asp. 
Hope you can help out. I 
think it's too bad that most code that 
is posted is not testen on other 
computers cause this is about the 24th 
time I mailed an author telling them 
the code doesn't work on my PC which is 
a shame. But no offense really just a 
general thought.
All the 
best,
Jos.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/16/2001 8:48:44 AM:Wesley
Yeah, well I think this code is really 
good...besides..it's in the beginner 
category.  Keep up the good work, I'll 
really enjoy your code :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/16/2001 12:01:25 PM:ChiefDND
I get the following error:
Microsoft 
VBScript runtime error '800a01ad' 
ActiveX component can't create 
object: 'Outlook.Application' 
Found 
Q194801 at http://support.microsoft.com
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/16/2001 7:15:38 PM:T Runstein
Thank you all for your feedback!  Jos, 
you are right, much of the code here 
isn't tested on enough machines (I wish 
I had access to more platforms).
I 
probably should have clarified that 
this script was created for a Windows 
Script Host application (part of a 
larger script that generates a report 
and emails it out).  However, it should 
work in ASP.
"Server." does need to 
be added for ASP as you've already 
discovered.  As far as the remaining 
error, sounds like Outlook is not 
registered on your web server (or 
something is spelled 
incorrectly).
On more point:  If you 
run this in ASP, use the .send, not the 
.display method - you won't want 
pending outgoing messages stacking up 
on your web server.
Let me know if 
you have any other questions or if 
you're still having trouble getting 
this to work.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/24/2001 7:50:14 AM:Brandon
I am having the following error when 
running the above code:
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/15/2001 2:08:47 PM:Andrew
I got the error:
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/15/2001 2:09:48 PM:Andrew
I get this error. Please e-mail me and 
tell me how to fix it. I am using an 
ASP page in Visual Interdev.
activex 
component can't create object 
'outlook.application'
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/15/2001 2:17:03 PM:Andrew
FIXED IT! 
Problem: ActiveX component 
can't create object 
'outlook.application'
Fix: Change your 
Internet Explorer security settings. 
Click Tools|Internet Options and 
then Security. Click the Internet zone 
and then click the Custom Level button. 
Select Prompt for the Initialize and 
script ActiveX Controls setting. Click 
OK. You will be prompted just before 
Microsoft Outlook initializes.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/16/2001 3:50:58 PM:Fred
In order to use this code, does the 
MS-Outlook 9.0 object library reference 
compatible with Outlook 2000. 
if yes, 
then I am still getting the 
error:
ActiveX component 
can't 
create object 
'outlook.application'
By the way, 
I already set the Internet Option 
security according to what has been 
suggested in the Discussions above.
I 
am developing ASP in Visual Interdev
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/23/2001 11:42:26 PM:manoj
how to register on the web server..?pls 
suggest i could not find the the name 
of dll used could u give me the name of 
dll to register?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/26/2001 8:40:46 AM:T Runstein
Outlook 2000 should work with this 
code.  msoutl9.dll must be registered 
on the server.
Since I wrote this code 
awhile back, I think it's time to 
update it!  I will put together a new 
submission to send email without using 
Outlook later this week.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/14/2002 3:40:38 PM:Ben
I've tried and tried to get this to 
work but with no success. I then toot 
he code and placed into a wsh script 
and ran it from a command prompt and it 
worked fine, so code itself works.  I 
don't get any errors about not being 
able to create the outlook object but 
that's where the script is getting 
hung!  I've even tried to call a wsh 
script inside an asp page, and that 
doesn't work.  That actually doesn't 
even error out.  Any help would be 
really helpful.  Thanks.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.