Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Send email from a different computer in a executable file
#8
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

Smile

Macro Macro2
Code:
Copy      Help
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);
}
}
}


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)