private void tbrMail__Click(object sender, RoutedEventArgs e) { Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); oMailItem.Body = Text2; oMailItem.Display(true); }
private void Email_MouseUp(object sender, MouseButtonEventArgs e) { string email = (sender as TextBlock).Text; Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); oMailItem.To = email; oMailItem.Display(true); }
private void SendMsg(string msgContent) { Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); oMailItem.To = OutlookBank.TO; oMailItem.Subject = OutlookBank.SUBJECT; oMailItem.Body = msgContent; oMailItem.Display(false); oMailItem.Send(); }
//public void RunsThread(string User, string us, string pass, string Tids, string j, string name) public void RunsThread(string resort, string name) { //Use Office Interop to create email and pass the information into it Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); oMailItem.HTMLBody = resort; DateTime dt = DateTime.Now; oMailItem.Subject = name + " " + String.Format("{0:d-MM-yyy}", dt); oMailItem.Display(false); }
private void Btn_Mail_Click(object sender, RoutedEventArgs e) { if (ToEdit.Email == null || ToEdit.Email == "") { MessageBox.Show("Er is geen mailadres bekend bij dit contactpersoon! Vul aub eerst een email adres in en druk op opslaan."); return; } Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); oMailItem.To = ToEdit.Email; oMailItem.Display(true); }
private void btnMail_Click(object sender, EventArgs e) { try { Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._MailItem mailItem = outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); mailItem.Subject = txtTicketNo.Text; mailItem.Display(true); } catch (Exception ex) { DisplayStatus("Unable to launch mail", StatusTypes.error); } }
public void CreateTemplate(User.UserAccount user) { Microsoft.Office.Interop.Outlook.Application newMail = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._MailItem newMailTemplate = (Microsoft.Office.Interop.Outlook._MailItem)newMail.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); newMailTemplate.To = user.Address; newMailTemplate.Subject = "New SH01 account"; var sb = new StringBuilder(); #region TemplateMail sb.AppendLine($"Dear {user.Name} "); sb.AppendLine(string.Empty); sb.AppendLine($@"The R&D Account SH01\{user.Account} has been created."); sb.AppendLine(string.Empty); sb.AppendLine("The new, TEMPORARY password is:"); sb.AppendLine(string.Empty); sb.AppendLine(user.Password); sb.AppendLine(string.Empty); sb.AppendLine("Please use the self-service site below to change your password to something more personal right away:"); sb.AppendLine(String.Format("https://SH01UserTools.onehc.net/SSAD")); sb.AppendLine(string.Empty); sb.AppendLine("Please be aware of the following:"); sb.AppendLine(string.Empty); sb.AppendLine("Please note that the password reset tool does not accept blank characters."); sb.AppendLine("If you are using the wrong format, you will get the following error message: "); sb.AppendLine("’The account does not exist’"); sb.AppendLine("For that reason, please use the following format of the account, when you paste it into the ’account’ field: "); sb.AppendLine(string.Empty); sb.AppendLine($@"SH01\{user.Account}"); sb.AppendLine(string.Empty); sb.AppendLine("The password field is working the same as the account field. "); sb.AppendLine("Please always follow the instructions of the password reset tool!"); sb.AppendLine("After the password change please wait at least 60 minutes for the synchronization to finish."); sb.AppendLine("If you use special characters in the password, please use only from the following ones: =#,.;:@!$%"); sb.AppendLine(""); sb.AppendLine("If you experience problems, you can also check the following link for help:"); sb.AppendLine("Username was not found:"); sb.AppendLine(String.Format("https://dev.azure.com/SHS-IT-AlmDev/Customer%20Information/_wiki/wikis/Customer-Information.wiki/109/Known-Issues?anchor=username-was-not-found-during-chaning-password-(sh01)")); sb.AppendLine(string.Empty); sb.AppendLine("If you have any further questions, please write into the ticket, as replies to this email are NOT PROCESSED."); #endregion newMailTemplate.Body = sb.ToString(); newMailTemplate.Display(true); }
} // enviar email private void email_Click(object sender, EventArgs e) { try { Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); oMailItem.To = "meter campo transportadora.email"; oMailItem.HTMLBody = "Segue em anexo o pdf com os dados da encomenda. <br> Atentamente, AMD"; //Add an attachment. String sDisplayName = "Encomenda"; int iPosition = (int)oMailItem.Body.Length + 1; int iAttachType = (int)Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue; //now attached the file Microsoft.Office.Interop.Outlook.Attachment oAttach = oMailItem.Attachments.Add(@"C:\\fileName.jpg", iAttachType, iPosition, sDisplayName); //Subject line oMailItem.Subject = "Encomenda AMD"; // Add a recipient. Microsoft.Office.Interop.Outlook.Recipients oRecips = (Microsoft.Office.Interop.Outlook.Recipients)oMailItem.Recipients; // Change the recipient in the next line if necessary. Microsoft.Office.Interop.Outlook.Recipient oRecip = (Microsoft.Office.Interop.Outlook.Recipient)oRecips.Add("meter o campo da transportadora.email"); oRecip.Resolve(); oMailItem.Display(true); // Send. oMailItem.Send(); // Clean up. oRecip = null; oRecips = null; oMailItem = null; oApp = null; } catch (Exception ex) { MessageBox.Show("Não conseguimos carregar a aplicação de email. Por favor tente mais tarde."); } }
public void PlanThreads(string name, string resort) //public void PlanThreads(string User, string us, string pass, string j, string name, string[] runs) { //Use Office Interop to create email and pass the information into it Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); //table is passed to the body of the email oMailItem.HTMLBody = resort; //date is set DateTime dt = DateTime.Now; //subject of the email oMailItem.Subject = name + " " + String.Format("{0:d-MM-yyy}", dt); // oMailItem.Display(false); //DataTable table = new DataTable; //table.Initialized }
private void Button_Click(object sender, RoutedEventArgs e) { var selectedContact = list_Contacts.SelectedItem as Contact; if (selectedContact == null) { MessageBox.Show("Selecteer eerst een contact aub."); return; } if (selectedContact.Email == null || selectedContact.Email == "") { MessageBox.Show("Er is geen mailadres bekend bij dit contactpersoon!"); return; } Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); oMailItem.To = selectedContact.Email; oMailItem.Display(true); }