Hello,
Thanks for your inquiry.
When using Spire.Email to send emails, you can send an email to any valid recipient email address, even if that recipient's email address does not exist in your computer's Outlook profile. The example code is as follows.
- Code: Select all
MailAddress addressFrom = new MailAddress("[email protected]", "Name");
MailAddress addressTo = new MailAddress("[email protected]");
MailMessage message = new MailMessage(addressFrom, addressTo);
message.Date = DateTime.Now;
message.Subject = "test";
string htmlString = @"
<html>
<body>
<p>Hello!</p>
<p>This is used for testing<br>Z<br>2023.7.6</p>
</body>
</html>";
message.BodyHtml = htmlString;
//SmtpClient
SmtpClient client = new SmtpClient();
client.Host = "smtp.outlook.com";
client.Port = 587;
client.Username = addressFrom.Address;
client.Password = "****";
client.ConnectionProtocols = ConnectionProtocols.Ssl;
client.SendOne(message);
If you have any other questions or concerns, please feel free to contact us anytime.
Sincerely
Wenly
E-iceblue support team