Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VBS, email, error checking and functions

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,64080
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBS, email, error checking and functions
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VBS, email, error checking and functions - 9/5/2008 11:44:34 PM   
  trey85stang

 

Posts: 3
Score: 0
Joined: 9/2/2008
Status: offline
Im a newb to vbs scripting.. but not a total newb to scripting though. I have a couple of questions if anyone would be kind to help.

The script I am writing has the CDO email method in it as described here: http://www.paulsadowski.com/WSH/cdo.htm

I have created functions for each different email message. My problem is I want to make the SMTP Server information a separate function that each email function calls.. but I can not seem to get this to work


      

Right now I get an error everytime I try putting the smtp information into a function, the script has about a dozen different email functions going to different people for different reason.. So I would like to cut down on the lines of code. Any ideas why this will not work? Can I not call a function from within a function? I dont recall every trying in any other script language.

Also, does anyone have any idea how I could error check if the email actually sent or not? these emails would be critical and I really need some kind of error checking to check if they sent susscefully or not.

I dont think I have any other questions yet :o
 
 
Post #: 1
 
 RE: VBS, email, error checking and functions - 9/7/2008 4:50:35 AM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
I think that the problem you are running into has to do with the differences between local and global scopes.
Basically, in your SMTP function, you are making changes to the objMessage object, but as soon as that function exits, those changes are lost - they only exist inside of that function.

To accomplish what you are wanting... being able to change the smtp server on the fly for each message, since the string used to determine the smtp server is only a string, why not draw that value from a function?

Example:

      


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to trey85stang)
 
 
Post #: 2
 
 RE: VBS, email, error checking and functions - 9/7/2008 7:33:48 PM   
  trey85stang

 

Posts: 3
Score: 0
Joined: 9/2/2008
Status: offline
thanks for the idea, That still kind of defeats what I was trying to do by limiting the lines of code. I guess the problem is a function inside a function in this case.

Still I am up for ideas on some way to error check the email function as a whole? I keep reading that instead of useing a function I could use a sub routine, and then do an exit value check? Ill have to wait til I get back to work to test that... I dont even have a computer at home with windows on it, so that should tell you guys I am out of my element here :o

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBS, email, error checking and functions Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts