我用HmailServer邮件服务器 配置账号 用程序发邮件总是显示已发送,查看HmailServer日志
"APPLICATION" 14588 "2013-03-06 16:04:34.649" "SMTPDeliverer - Message 152 - Connection failed: Host name: 64.71.138.86, message: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。"
"APPLICATION" 14588 "2013-03-06 16:04:55.650" "SMTPDeliverer - Message 152 - Connection failed: Host name: 64.71.138.87, message: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。"
"APPLICATION" 14588 "2013-03-06 16:05:16.652" "SMTPDeliverer - Message 152 - Connection failed: Host name: 112.90.137.120, message: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。"
"APPLICATION" 14588 "2013-03-06 16:05:37.657" "SMTPDeliverer - Message 152 - Connection failed: Host name: 112.95.241.138, message: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。"
"APPLICATION" 9756 "2013-03-06 16:05:37.658" "SMTPDeliverer - Message 152: Message could not be delivered. Scheduling it for later delivery."
"APPLICATION" 9756 "2013-03-06 16:05:37.660" "SMTPDeliverer - Message 152: Message delivery thread completed."
"APPLICATION" 1848 "2013-03-06 16:06:43.642" "SMTPDeliverer - Message 153: Delivering message from mossadmin@sharenet.com to 120182056@qq.com. File: C:\Program Files (x86)\hMailServer\Data\{46FC0A82-A12D-4B4A-A128-0467AC9E6CAE}.eml"
"APPLICATION" 12600 "2013-03-06 16:07:04.648" "SMTPDeliverer - Message 153 - Connection failed: Host name: 119.147.192.101, message: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。"
"APPLICATION" 12600 "2013-03-06 16:07:25.649" "SMTPDeliverer - Message 153 - Connection failed: Host name: 119.147.192.199, message: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。"
程序static void Main(string[] args)
{
var aaa = Send("mossadmin@xxx.com", "120182056@qq.com", "邮件主题", true, "内容2222", "127.0.0.1", "mossadmin", "pass");
/// </summary>
/// <param name="from">发送人邮件地址</param>
/// <param name="to">接收人邮件地址</param>
/// <param name="subject">邮件主题</param>
/// <param name="isBodyHtml">是否是Html</param>
/// <param name="body">邮件体</param>
/// <param name="smtpHost">SMTP服务器地址</param>
/// <param name="userName">用户名</param>
/// <param name="password">密码</param>
/// <returns>是否成功</returns>
}
public static bool Send(string from, string to, string subject, bool isBodyHtml, string body, string smtpHost, string userName, string password)
{
string[] ts = to.Split(',');
bool isSuccess = true;
foreach (string t in ts)
{
try
{
MailMessage mm = new MailMessage();
mm.From = new MailAddress(from);
mm.To.Add(new MailAddress(t.Trim()));
mm.Subject = subject;
mm.IsBodyHtml = isBodyHtml;
mm.Body = body;
SmtpClient sc = new SmtpClient();
sc.Host = smtpHost;
sc.Port = 25;
sc.UseDefaultCredentials = true;//winform中不受影响,asp.net中,false表示不发送身份严正信息
//smtpClient.EnableSsl = true;//如果服务器不支持ssl则报,服务器不支持安全连接 错误
sc.Credentials = new System.Net.NetworkCredential(userName, password);
sc.DeliveryMethod = SmtpDeliveryMethod.Network;
sc.Send(mm);
}
catch (Exception exception)
{
Console.WriteLine(exception);
}
}
return isSuccess;
}
发送服务器25端口没开?
安装客户端 能将邮件发送出去
端口是开着的啊
@miloss: 真的很抱歉...没能帮你解决.
是部分邮件没有发出去还是全部没有发出去?
如果是部分,可能是被服务器认为是发送垃圾邮件的暂时屏蔽了.
最后没有解决