Hi ,
i'm trying to save a mail on disk. Import the file later and, if nedeed, change the subject or an address (or add). But Import looks not to be working
I've these 2 functions to saveToFile and readFromFile
I created a messsage , saved this as file, read it from file added a CC addresss and saved it with a new name... they are not te same!
What am i doing wrong?
thanks.
private IMail _email = null;
private MailBuilder _message = null;
public Boolean SaveMailMessage(string tcFullFileName)
{
try
{
tcFullFileName = Path.ChangeExtension(tcFullFileName, "eml");
if (File.Exists(tcFullFileName))
{
File.Delete(tcFullFileName);
}
if (_email == null) {
_email = _message.Create();
}
byte[] byteArr = _email.Render(AddressHeaderRenderMode.Full);
File.WriteAllBytes(tcFullFileName, byteArr);
return File.Exists(tcFullFileName);
}
catch (Exception ex)
{
AddErrorInfo(ex.Message, "SaveMailMessage");
return false;
}
}
public Boolean LoadFromFile(string tcFullFileName)
{
tcFullFileName = Path.ChangeExtension(tcFullFileName, "eml");
_message = new MailBuilder();
_message.CreateFromEmlFile(tcFullFileName);
return true;
}