private static void SendUsingMapiMail(Email.Email email, Checks checks) { var mailer = new MapiMail(); int?result = mailer.SendMail(email, checks); if (result == 0) { MessageBox.Show("Mail sent successfully"); } }
private void OnSendMail(object sender, RoutedEventArgs args) { args.Handled = true; try { MapiMail.SendMail("Test Message", "This is the text of the test message.", new[] { new MapiAddress("", AddressBox.Text) }, null); } catch (MapiException e) { MessageBox.Show(this, e.Message, "Simple MAPI Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void OnResolveName(object sender, RoutedEventArgs args) { args.Handled = true; try { MapiAddress recip = MapiMail.ResolveName(AddressBox.Text); AddressBox.Text = StringUtility.Validate(recip.Address, recip.Name); } catch (MapiException e) { MessageBox.Show(this, e.Message, "Simple MAPI Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
static void Main() { var mail = new MapiMail(); mail.Subject = "Some Subject"; mail.MessageBody = "This is the message content"; mail.Recipients.Add("*****@*****.**"); mail.BccRecipients.Add("*****@*****.**"); mail.SendPopup(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainWindow()); }
private void OnAddressBook(object sender, RoutedEventArgs args) { args.Handled = true; try { MapiAddress[] recips = MapiMail.Address(); if (recips.Length > 0) { AddressBox.Text = StringUtility.Validate(recips[0].Address, recips[0].Name); } } catch (MapiException e) { MessageBox.Show(this, e.Message, "Simple MAPI Error", MessageBoxButton.OK, MessageBoxImage.Error); } }