C# smtp.qiye.163.com
时间: 2024-02-05 10:08:00 浏览: 136
以下是C#中使用smtp.qiye.163.com发送邮件的示例代码:
```csharp
using System.Net.Mail;
// 创建一个MailMessage对象
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("发件人邮箱");
mailMessage.To.Add("收件人邮箱");
mailMessage.Subject = "邮件主题";
mailMessage.Body = "邮件内容";
// 创建一个SmtpClient对象
SmtpClient smtpClient = new SmtpClient();
smtpClient.Host = "smtp.qiye.163.com";
smtpClient.Port = 25;
smtpClient.EnableSsl = true;
smtpClient.Timeout = 60000;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new System.Net.NetworkCredential("发件人邮箱", "邮箱密码");
// 发送邮件
smtpClient.Send(mailMessage);
```
阅读全文