Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6651803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:03:17+00:00 2026-05-26T01:03:17+00:00

Possible Duplicate: How to save MailMessage object to disk as *.eml or *.msg file

  • 0

Possible Duplicate:
How to save MailMessage object to disk as *.eml or *.msg file

I am working on a C# program that emails people when certain conditions are met. I want to be able to save a copy of the email for record keeping and can’t figure it out. I find it surprising there is just not a built it function like message.Save().

I have included a very basic email sample below:

MailMessage message = new MailMessage("from_email", "to_email");
message.Subject = "Email Alert"; 
message.Body = "This is a test email.";
SmtpClient Smtp = new SmtpClient("smtp server");
Smtp.Send(message);

I would like to save a copy of the email for a record. I didn’t really consider all the choices of ways to store the message, sorry for that. I would like to have copy in case the recipient didn’t receive the email I could forward them a copy from archive. I think a .msg would work well.

Another addition, I would like to be able to save the email and then send a batch at the end of the day. In case I receive updates that needed to be added I could have to program add new entries to the email so that recipient wouldn’t be overloaded with multiple emails. However, there would be some cases where their would be escalation level when met an email would automatically be sent regardless of the time of day.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:03:17+00:00Added an answer on May 26, 2026 at 1:03 am

    A couple of different ways to "back up" your email messages so they could be resent if necessary:

    • ProcMail. Depending on the MTA you’re using, it would be easy enough to write a ProcMail recipe to archive messages as your MTA sends them. If you’re using Exchange, the same can be done on the server side of things.

    • XML Serialization. After you create each instance of the MailMessage class, serialize it and store it, either in the file system, or in a database. Should be easy enough to rehydrate instance when needed.

    • Pickup Directory. The SmtpClient class can be configured to "send" messages to a "Pickup Directory." This is normally used in a configuration where the MTA (message transport agent) is configured to watch a particular directory. Sending mail then consists of dropping a file containing an RFC 2822-compliant message into the directory, where it will shortly get collected by the MTA and sent on its way. If no MTA is configured to watch the pickup directory, the mail message will just get dropped there and sit.

      This is a useful way of testing the app that does the mailing without involving a real MTA. People tend to get grumpy when they get slammed with junk messages.

      It’s also a useful technique for archiving: Configure 2 SmtpClient instances in your program: one configured to talk to your MTA and the other configured to drop the message in a pickup directory. Post each MailMessage you create to both instances and you’ll have your archive.

    Any one of these techniques should work for you. If you actually need to re-send the email, XML serialization might be the best option for you, as rehydrating an object instance is pretty trivial to do via XML serialization.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Create Excel file in Java How to save output in excel format
Possible Duplicate: When is it OK to use an XML file to save information?
Possible Duplicate: Open file, write to file, save file as a zip and stream
Possible Duplicate: Disable browser ‘Save Password’ functionality Is there a standard way to prevent
Possible Duplicate: Get the Files inside a directory Is there a function that can
Possible Duplicate: Convert Data URI to File then append to FormData Is it possible
Possible Duplicate: What's a quick way to test to see a file exists? I
Is it possible to save a whole C# solution in one single text file?
Possible Duplicate: Save Youtube video to iPhone in the app I want to download
Possible Duplicate: Maintain/Save/Restore scroll position when returning to a ListView The user views a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.