Aspose.Email.Examples.CSharp.Email.IMAP.CustomizingEmailHeaders.Run C# (CSharp) Метод

Run() публичный статический Метод

public static Run ( ) : void
Результат void
        public static void Run()
        {
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_SMTP();
            string dstEmail = dataDir + "MsgHeaders.msg";

            // Create an instance MailMessage class
            MailMessage msg = new MailMessage();

            // Specify ReplyTo
            msg.ReplyToList.Add("[email protected]");

            // From field
            msg.From = "[email protected]";

            // To field
            msg.To.Add("[email protected]");

            // Adding Cc and Bcc Addresses
            msg.CC.Add("[email protected]");
            msg.Bcc.Add("[email protected]");

            // Message subject
            msg.Subject = "test mail";

            // Specify Date
            msg.Date = new DateTime(2006, 3, 6);

            // Specify XMailer
            msg.XMailer = "Aspose.Email";

            // Specify Secret Header
            msg.Headers.Add("secret-header", "mystery");

            // Save message to disc
            msg.Save(dstEmail, SaveOptions.DefaultMsgUnicode);

            Console.WriteLine(Environment.NewLine + "Message saved with customized headers successfully at " + dstEmail);
        }
    }
CustomizingEmailHeaders