Click here to Skip to main content
11,930,830 members (49,389 online)
Click here to Skip to main content


67 bookmarked

Adding Save() functionality to System.Net.Mail.MailMessage

, 19 Nov 2014 CPOL
Using a combination of Reflector, Reflection, and C# 3.0 extension methods to add Save(string FileName) functionality to MailMessage in System.Net.Mail.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;

namespace MailMessageExtension
    class Program
        static void Main(string[] args)
            MailMessage _testMail = new MailMessage();
            _testMail.Body = "This is a test email";
            _testMail.To.Add(new MailAddress(""));
            _testMail.From = new MailAddress("");
            _testMail.Subject = "Test email";

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Allan Eagle
Software Developer Globe Business Publishing Ltd
United Kingdom United Kingdom
Started tinkering on an old BBC Microcomputer using BBC BASIC and progressed up to dabbling with C and ARMCode on an Acorn RiscPC. Moving to the PC platform I progressed from C++ to now a lot of C# and ASP.NET.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151126.1 | Last Updated 19 Nov 2014
Article Copyright 2009 by Allan Eagle
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid