2

我目前正在使用 smtp 从我的代码中发送邮件,但似乎我们必须迁移到交换服务器,这两者之间有区别吗?我需要对代码进行哪些更改?

MailMessage loginInfo = new MailMessage();
loginInfo.To.Add("estinationaddress.@ca");
loginInfo.From = new MailAddress("abc@sde.ca");
loginInfo.Subject = "ABC";
loginInfo.Body = "Your username is: " +"abc";
loginInfo.IsBodyHtml = true;

SmtpClient smtp = new SmtpClient();
smtp.Host = "www.smtphost.com";
smtp.Port = 25;
smtp.EnableSsl = false;
smtp.Credentials = new System.Net.NetworkCredential("abc@sde.ca","abc");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(loginInfo);

我的代码需要进行哪些更改?

4

0 回答 0