The environment of a function is unique - the variable $User defined in the main program as a local will not be visible in the function. Thus, if you don't define it in the function, you'll get an undeclared var error when Explicit is enabled. You need to define the vars in the functions, too.

That's why I add the "_" to my function var names - just to reinforce that they are unique to the function. It also protects against corruption due to variable reuse if Explicit is off.

As far as passing vars to a function, you need to pass everything that the function will need. Remember that the function gets a copy of the data, not the actual data, so you can't just modify the data in a function the way you can in a subroutine. (Subroutines are in the same memory context as the main program.) So, in your example, you'd need to pass EMailServer, IT_Email, System, etc..

Glenn
_________________________
Actually I am a Rocket Scientist! \:D