When the message is sent, i want to save the message in the "Sent" box.
I can add the message to the sent box, but the message is coming empty ( only date coming that i can see )
I couldn't save message From, Fromaddress or Body etc.
this is my simple code:
Code: Select all
// This for send message
string subject = model.subject;
string recipient = model.recipient;
string body = model.body;
hMailServer.Message message = new hMailServer.Message();
message.From = "from";
message.FromAddress = "fromaddress";
message.Subject = subject;
message.AddRecipient(recipient, recipient);
message.Body = body;
// This for Sent Box
hMailServer.ApplicationClass application = new hMailServer.ApplicationClass();
application.Authenticate("Administrator", "password");
hMailServer.Domain domain = application.Domains.ItemByName["domain.com"];
hMailServer.Accounts accounts = domain.Accounts;
hMailServer.Account mailbox = accounts.ItemByAddress["someone@domain.com"];
hMailServer.IMAPFolders imapFolders = mailbox.IMAPFolders;
hMailServer.IMAPFolder imapfolder = imapFolders.ItemByName["Sent"];
hMailServer.Messages messages = imapfolder.Messages;
// This for Adding message into "Sent" box
message = messages.Add();
message.Save();
If these codes are incorrect, can you show me a way , I can manually add them with the Messages.Add () command
is it possible manually? Messages.Add () with message content
Thank you.