SmtpClient Client = new SmtpClient(SMTPClientHostName, 25)
{
EnableSsl = true,
Timeout = 30000,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new System.Net.NetworkCredential(SenderEmailAddress, SenderEmailAddressPassword)
};
Object Object = MailMessage;
Client.SendCompleted += new SendCompletedEventHandler(SMTPClient_SendCompleted);
Client.SendAsync(MailMessage, Object);
我试图通过SendAsync发送电子邮件。它永远不会到来。
活动:
private static void SMTPClient_SendCompleted(object Sender, System.ComponentModel.AsyncCompletedEventArgs AsyncCompletedEvent)
{
MailMessage MailMessage = AsyncCompletedEvent.UserState as MailMessage;
}
自我发送以来已经十分分钟。 消息 以Send发送。
这里有什么问题?
更新:我的代码包含使用;删除后,电子邮件开始到达。有谁知道为什么?