Beispiel #1
0
        public virtual MAPI SendMail(MailMessage mailMessage)
        {
            const int mapiLogonUi = 0x00000001;
            const int mapiDialog = 0x00000008;
            const int how = mapiLogonUi | mapiDialog;

            _message = new MapiMessage { subject = mailMessage.Subject(), noteText = mailMessage.Body() };

            _message.recips = GetRecipients(mailMessage, out _message.recipCount);
            _message.files = GetAttachments(mailMessage, out _message.fileCount);

            var errorId = MAPISendMail(new IntPtr(0), new IntPtr(0), ref _message, how, 0);
            if (errorId > 1)
                throw new MAPIException(errorId);

            return this;
        }