+1 vote

Hi i have written a code to save the mail to Drafts folder as follows

long? draftID = 0;
MailBuilder builder = new MailBuilder();
builder.From.Add(new MailBox("demo@x.com"));
builder.To.Add(new MailBox("demo@some.com"));
IMail email = builder.Create();
using (Imap imap = new Imap())
{
  imap.ConnectSSL("imap.server.com");
  imap.UseBestLogin("userName", "password");
  FolderInfo drafts = new CommonFolders(imap.GetFolders()).Drafts;
  draftID = imap.UploadMessage(drafts, email);
}

this is successfully saving in my drafts, now if I do some changes for the same mail and click on save I need to update the mail so can some one help me

by (1.0k points)
retagged by

1 Answer

+1 vote
 
Best answer

IMAP is designed for server-side management of emails, not for editing messages. So unfortunately you need to delete existing email and upload the new one.

There exists CATENATE extension - it allows modifying parts of existing message (draft) - however it is not that easy to use, and many servers don't support it.

by (301k points)
selected by
Thanks I need one more i.e while saving to drafts using the method it is saying that To Address is mandatory, so how can I save to drafts with out giving to address
Who says, that To is mandatory? Mail.dll doesn't impose such restriction, when uploading the email. If it's the server you'll need to provide fake address.
Thanks it's my mistake in code, I didn't check for empty string
...