Armazenar mensagens na pasta enviados

Topics: Help requests
Dec 23, 2013 at 5:16 PM
Edited Dec 23, 2013 at 5:18 PM
hi, I'm using this extension to generate the file and record in the sent folder. Is there any way already implemented in the library?

myfolder.AppendMessage(mail.ToEml(), null, DateTime.Now);

example: myfolder.Store(message); / myfolder.SendAndStore(message);
public static class MailExtensions
        public static string ToEml(this MailMessage mail)
            var stream = new MemoryStream();
            var mailWriterType = mail.GetType().Assembly.GetType("System.Net.Mail.MailWriter");
            var mailWriter = Activator.CreateInstance(
                                type: mailWriterType,
                                bindingAttr: BindingFlags.Instance | BindingFlags.NonPublic,
                                binder: null,
                                args: new object[] { stream },
                                culture: null,
                                activationAttributes: null);

                                name: "Send",
                                invokeAttr: BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod,
                                binder: null,
                                target: mail,
                                args: new object[] { mailWriter, true, true });

            return Encoding.UTF8.GetString(stream.ToArray());
Dec 23, 2013 at 7:25 PM
Hi lupinacci,

you can use Folder.AppendMessage(System.Net.MailMessage) for this task. However, you must consider that it uses a similar extension in background and this method overload is not available for the Windows Phone version of the library.



PS: Please use english in forum thread names.