MailAddress fromAddress = new MailAddress("[email protected]");
MailAddress toAddress = new MailAddress("[email protected]", "John Smith");This code creates a new MailAddress object with the email address "[email protected]" and the display name "John Smith". To use the MailAddress class, the System.Net.Mail package library needs to be included in the project.