User-709623068 posted
I am trying to create a web form that takes a users email address and then sends them a confirmation email. The problem I am having is that all other email address (that I have tested) work, except for hotmail accounts. Is this a known issue? I have created
a few brand new accounts on hotmail just to test them, and still nothing. I have configured the mail server, and will post the code I am using to send the email. Thanks:
protected void btnEmail_Click(object sender, EventArgs e)
{
string fromAddress = "someEmailAddress@hotmail.com";
string fromName = "Todd";
string toFirstName = txtFirstName.Text;
string toLastName = txtLastName.Text;
string toAddress = txtEmailAddress.Text;
string subject = "CDONTS Exercise";
string body = string.Format("Thank you {0} {1} for letting us send you this email.", toFirstName, toLastName);
MailAddress fromAdd = new MailAddress(fromAddress, fromName);
MailAddress toAdd = new MailAddress(toAddress);
MailAddress ccAdd = new MailAddress(fromAddress);
MailMessage msg = new MailMessage(fromAdd, toAdd);
msg.Subject = subject;
msg.Body = body;
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;
//msg.CC.Add(ccAdd);
SmtpClient client = new SmtpClient();
client.Send(msg);
string confirmMessage = "An email has been sent to you.";
lblConfirmMessage.Text = confirmMessage;
lblMessage.Text = body;
}