01-04-2017, 03:54 PM
Thank you very much, I use Microsoft's outlook mailbox, the successful delivery of mail (code as follows), but the password is clear, how to encrypt the display?
The use of QM built-in send mail method, has not been successful, I hope to further improve
Macro Macro2
The use of QM built-in send mail method, has not been successful, I hope to further improve
Macro Macro2
CsFunc("" "password" "[email protected]" "Subject" "Body")
#ret
//C# code
using System;
using System.Net;
using System.Net.Mail;
public class Email
{
static public void Send(string password, string email, string subject, string body)
{
var fromAddress = new MailAddress("[email protected]", "From Name");
var toAddress = new MailAddress(email);
var smtp = new SmtpClient
{
;;;;Host = "smtp-mail.outlook.com",
;;;;Port = 25,
;;;;EnableSsl = true,
;;;;DeliveryMethod = SmtpDeliveryMethod.Network,
;;;;UseDefaultCredentials = false,
;;;;Credentials = new NetworkCredential(fromAddress.Address, password)
};
using (var message = new MailMessage(fromAddress, toAddress)
{
;;;;Subject = subject,
;;;;Body = body
})
{
;;;;smtp.Send(message);
}
}
}