在我的应用程序中,我使用SmtpClient
发送电子邮件(仅限于gmail账户)。一切都很好,很完美。取消使用smtp发送邮件SMTP
我在Gmail中看到一个选项,允许我们取消/撤消发送邮件。如下图所示。在这里我的问题是关于这个问题,我如何根据一些条件取消/撤销从我的程序发送的邮件。
下面是使用用于发送邮件的代码我':
MailMessage mail = new MailMessage("[email protected]", "[email protected]");
SmtpClient client = new SmtpClient();
client.Port = 587;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("[email protected]", "xxxxxxx");
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
client.Send(mail);
// this is what i want to do
if(someCondition=true)
{//undo the send operation}
这不是SMTP的功能。只需让您的程序安排在30秒内发送电子邮件,而不是立即发送。 – spender