It can be set in the web.config or app.config under the <system.net><mailSettings><smtp> section if you don't want it in the code.

See......