C#winforms发送电子邮件异常

时间:2015-09-09 02:08:25

标签: c# email

我有一个winforms应用程序,可以发送包含以下代码的电子邮件:

MailMessage mail = new MailMessage();
mail.To.Add(textBox1.Text);
mail.Priority = MailPriority.High;
mail.From = new MailAddress("autoemailer@no-reply", "Auto Email");
mail.Subject = "Test Email";
mail.Body = "Kindly disregard if received";

SmtpClient smtp = new SmtpClient();
smtp.Host = "172.16.224.7";
smtp.Port = 25; //587;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential
    ("username", "password"); // Sender's user name and password. Note: The username and password here is an example. Real username and password are the same as outlook's

try
{
    smtp.Send(mail);
    MessageBox.Show("Sent!");
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
}

我遇到以下异常:

  

系统存储不足。服务器响应是:4.3.1   系统资源不足

异常消息很清楚,服务器的存储/资源不足。但是,当我尝试通过Outlook发送电子邮件时,它已成功发送。代码有问题吗? TIA提供任何帮助。

0 个答案:

没有答案