Mailmessage

You're referring to the MailMessage class in.NET!

The MailMessage class is a part of the System.Net.Mail namespace and is used to create and send email messages in.NET applications. It provides a way to create a message with a subject, body, and attachments, and then send it to one or more recipients using a mail server.

Here are some key properties and methods of the MailMessage class:

Properties:

Methods:

Here's an example of how to use the MailMessage class to send an email:

using System.Net.Mail;

// Create a new MailMessage object
MailMessage mail = new MailMessage();

// Set the sender and recipient
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");

// Set the subject and body
mail.Subject = "Test Email";
mail.Body = "This is a test email message.";

// Add an attachment
mail.Attachments.Add(new Attachment("attachment.txt"));

// Send the email
SmtpClient client = new SmtpClient();
client.Send(mail);

Note that this is just a basic example, and you may need to add additional configuration and error handling depending on your specific requirements.