Prepend information to Subject line of exchange message

We're going to be automating the processing of attachment in exchange mailboxes.

In doing so we'd like to prepend the subject field with information that indicates that email has been processed. I'm brand new to Aspose.Email for .NET, so just need a nudge in the right direction.

thanks and Regards
Dave

Hi Dave,

Thank you for contacting Aspose support team.

Messages in a folder can be updated such that first we have to delete the existing message and then append the modified message in the same folder. Following is a sample code which extracts all the unread messages from inbox of exchange account and performs the following steps:

  1. Extract the message
  2. Delete this message from exchange server
  3. Modify the message
  4. Append it back to the inbox

Could you please give a try to the following code and let us know your feedback?

public static bool CheckCertificate(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)

{
return true;
}

public static void TestMessageUpdate()

{

using (ImapClient _client = new ImapClient(“[exchange.domain.com](http://exchange.domain.com/)”, 993, "user@aspose.com", “password”, CheckCertificate))
{
_client.EnableSsl = true;
_client.SecurityMode = ImapSslSecurityMode.Implicit;
try
{
//this query is for returning only the unread
ImapQueryBuilder imapbuilder = new ImapQueryBuilder();
imapbuilder.HasNoFlags(ImapMessageFlags.IsRead);
Aspose.Email.MailQuery query = imapbuilder.GetQuery();
ImapMessageInfoCollection messageInfos = _client.ListMessages(query);
if (messageInfos.Count > 0)
{
for (int i = 0; i < messageInfos.Count; i++)
{
ImapMessageInfo info = messageInfos[i];
MailMessage message = null;
try
{
message = _client.FetchMessage(info.UniqueId);
_client.DeleteMessage(info.UniqueId);
message.Subject = “Processed:” + message.Subject;
_client.AppendMessage(message);
}
catch (Exception ex)
{

Console.WriteLine(ex.Message);
}
}
}
}
catch (Exception ex)
{

Console.WriteLine(ex.Message);
}
}
}

Thank you Kashifv for your prompt reply!

I'll give this a go and get back to you soon.

best regards

Dave

Hi Dave,


You are welcome and let us know if we can be of any additional help to you in this regard.