System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient([Host], [Port]);<br />smtp.Credentials = new System.Net.NetworkCredential([UserName], [Password]);
If you prefer, use the config file (web.config, app.config).
<system.net><br /> <mailSettings><br /> <smtp><br /> <network host="" port="" userName="" password="" /><br /> </smtp><br /> </mailSettings><br /></system.net>