If you are working with InfoPath 2003, sooner or later you’ll encounter situations requiring you to obtain information from a config file. If you are using Visual Studio 2003 you can add a config file to the project, but reading from that file is not possible using the configuration reader. You can load that file as an XML file and have to read from that. So, loading data from config file is not a straight forward task. However, there are certain workarounds for this.
Instead of using the app.config file, we can create a simple XML file and read from that file using the classes in System.Xml namespace. This also gives you the leisure of having the required schema, so you can load directly into, say, a dataset if the config file is complex.
To give a more professional look for this, it would be friendly for the user to provide an InfoPath form that will save the information into the required config xml file.
Attached is the sample InfoPath 2003 form (using Visual Studio 2005) which uses config settings taken from the xml file generated using another Config form to send mails.
This approach requires the forms to be provided with Full-trust and digitally signed