MailMessage theMailMessage = new MailMessage("from@email.com", "to@email.com"); theMailMessage.Body = "body email message here"; theMailMessage.Attachments.Add(new Attachment("pathToEmailAttachment")); theMailMessage.Subject = "Subject here"; SmtpClient theClient = new SmtpClient("IP.Address.Of.Smtp"); theClient.UseDefaultCredentials = false; System.Net.NetworkCredential theCredential = new System.Net.NetworkCredential("user@name.com", "password"); theClient.Credentials = theCredential; theClient.Send(theMailMessage); |
桌面程序通过smtp发送邮件简单例子 Winform send email sample (desktop application send email via smtp)
最新推荐文章于 2018-07-02 07:32:16 发布
