0

我复制该代码 MailMessage mail = new MailMessage();

        mail.To.Add(model.To);

        mail.From = new MailAddress("sheikh.abm@gmail.com");


        mail.Subject = model.Subject ;

        mail.Body = model.Message;

        mail.IsBodyHtml = true;

        SmtpClient client = new SmtpClient("localhost:");
        client.UseDefaultCredentials = false;
        client.EnableSsl = true;
        client.Host = "localhost:";
        client.Port = 25;

        NetworkCredential credentials = new NetworkCredential(model.To, "abc");

        client.Credentials = credentials;

        try
        {
            client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
            client.Send(mail);
        }
        catch
        {



        }
        return View("Index");
    }

我得到的例外是“不得为拾取目录交付方法启用 SSL”。

4

0 回答 0