This project has moved and is read-only. For the latest updates, please go here.

System.Net.Mail.MailMessage Extension Methods

MailMessage.Send Method

A MailMessage extension method that send this message.

Syntax

void Send(MailMessage @this)

Parameters

@this
The @this to act on.

Examples


 // Copyright (c) 2013 Jonathan Magnan (http://zzzportal.com)
 // All rights reserved.
 // Licensed under MIT License (MIT)
 // License can be found here: https://zextensionmethods.codeplex.com/license
 
 using System;
 using System.Net.Mail;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Z;
 
 namespace ExtensionMethods.Examples
 {
     [TestClass]
     public class System_Net_Mail_MailMessage_Send
     {
         [TestMethod]
         [ExpectedException(typeof (InvalidOperationException))]
         public void Send()
         {
             // Type
             var @this = new MailMessage("noreply@zzzportal.com", "noreply@zzzportal.com", "Fizz", "Buzz");
 
             // Examples
             @this.Send(); // Send a mail
         }
     }
 }
                

MailMessage.SendAsync Method

A MailMessage extension method that sends this message asynchronous.

Syntax

void SendAsync(MailMessage @this,object userToken)

Parameters

@this
The @this to act on.
userToken
The user token.

Examples


 // Copyright (c) 2013 Jonathan Magnan (http://zzzportal.com)
 // All rights reserved.
 // Licensed under MIT License (MIT)
 // License can be found here: https://zextensionmethods.codeplex.com/license
 
 using System;
 using System.Net.Mail;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Z;
 
 namespace ExtensionMethods.Examples
 {
     [TestClass]
     public class System_Net_Mail_MailMessage_SendAsync
     {
         [TestMethod]
         [ExpectedException(typeof (InvalidOperationException))]
         public void SendAsync()
         {
             var token = new object();
 
             // Type
             var @this = new MailMessage("noreply@zzzportal.com", "noreply@zzzportal.com", "Fizz", "Buzz");
 
             // Examples
             @this.SendAsync(token); // Send a mail async
         }
     }
 }
                

Last edited Nov 23, 2013 at 7:55 PM by Jonathan_Magnan, version 1