Saves the current message to the specified file.
| Exception Type | Condition |
|---|---|
| ArgumentNullException | path is a null reference (Nothing in Visual Basic). |
| ArgumentException | path contains invalid characters, is empty, or contains only white spaces. |
| FileNotFoundException | path cannot be found. |
| SecurityException | The caller does not have the required permission. |
| DirectoryNotFoundException | path is invalid, such as being on an unmapped drive. |
| UnauthorizedAccessException | The access requested is not permitted by the operating system for the specified path. |
| PathTooLongException | The specified path exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters. |
| IOException | An I/O error occurs. |
| MailMillException | Some message headers were not properly set -or- you try to sign or encrypt the message and CAPICOM 2.0 is not installed -or- you try to sign the message and the sender certificate was not found -or- you try to encrypt the message a receiver certificate was not found. |
| COMException | An error occured while signing or encrypting a message. |
This sample shows how to save a basic text plain message.
Mail oMail = new Mail(); oMail.From = "Sender <sender@emilltest.com>"; oMail.Tos.Value = "Receiver <receiver@emilltest.com>"; oMail.Subject = "Test message"; oMail.TextBody = "Hello World"; oMail.Save(@"c:\mailbackup\test.eml");
Mail Class | MailMill Namespace