UHCL Banner

Sending SMTP Email

The DCM server no longer has an SMTP server due to security issues. We suggest that you use a free gmail account to send your email.

ASP.NET Example

In web.config

<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="username@gmail.com">
<network defaultCredentials="false" host="smtp.gmail.com" port="587" userName="username@gmail.com" password="******" />
</smtp>
</mailSettings>
</system.net>
</configuration>

In .cs file

protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
MailMessage mm = new MailMessage();
mm.From = e.Message.From;
mm.Subject = e.Message.Subject.ToString();
mm.To.Add(e.Message.To[0]);
mm.Body = e.Message.Body;
SmtpClient smtp = new SmtpClient();
smtp.EnableSsl = true;
smtp.Send(mm);
e.Cancel = true;
}