Godaddy说我们无法获得有关此事的信息
try
{
//Create the msg object to be sent
MailMessage msg = new MailMessage();
//Add your email address to the recipients
msg.To.Add("ramuglp@gmail.com");
//Configure the address we are sending the mail from
MailAddress address = new MailAddress("ramuglp@gmail.com ");
msg.From = address;
msg.Subject = "TEST";
msg.Body = "TEST BODY";
//Configure an SmtpClient to send the mail.
SmtpClient client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Host = "smtp.gmail.com";
client.Port = 25;
//Setup credentials to login to our sender email address ("UserName", "Password")
NetworkCredential credentials = new NetworkCredential("ramuglp@gmail.com", "**********");
client.UseDefaultCredentials = true;
client.Credentials = credentials;
//Send the msg
client.Send(msg);
//Display some feedback to the user to let them know it was sent
confirmationLabel.Text+ = "Your message was sent!";
}
catch (Exception ex)
{
//If the message failed at some point, let the user know
confirmationLabel.Text = "Your message was NOT sent!"+ex.ToString();
//"Your message failed to send, please try again."
}