private async void Share(object sender, RoutedEventArgs e) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Subject = listItemViewModels.select_item.title; emailMessage.Body = "due time: " + listItemViewModels.select_item.date + "\n" + "description: " + listItemViewModels.select_item.detail + "\n\n"; string[] parts = listItemViewModels.select_item.image_uri.Split('/'); string fileName = parts[parts.Length - 1]; StorageFolder folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync( "Picture", CreationCollisionOption.OpenIfExists); var attachmentFile = await folder.GetFileAsync(fileName); var stream = RandomAccessStreamReference.CreateFromFile(attachmentFile); var attachment = new Windows.ApplicationModel.Email.EmailAttachment( attachmentFile.Name, stream); emailMessage.Attachments.Add(attachment); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void DennisMail_Click(object sender, RoutedEventArgs e) { #if WINDOWS_PHONE_APP //predefine Recipient Windows.ApplicationModel.Email.EmailRecipient sendTo = new Windows.ApplicationModel.Email.EmailRecipient() { Address = "*****@*****.**" }; Windows.ApplicationModel.Email.EmailRecipient sendCc = new Windows.ApplicationModel.Email.EmailRecipient() { Address = "*****@*****.**" }; //generate mail object Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.Subject = "Hi Prog Party!"; mail.Body = "You are great"; //add recipients to the mail object mail.To.Add(sendTo); mail.CC.Add(sendCc); //open the share contract with Mail only: await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); #endif }
private async void btnSendEmail_Click(object sender, RoutedEventArgs e) { Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**", "小醉魔")); mail.Subject = "用户的来信"; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
/// <summary> /// 发送邮件 /// </summary> /// <param name="emailAddress">邮箱地址</param> /// <param name="emailSubject">主题</param> /// <param name="messageBody">邮件内容</param> private static async void SendEmail(string emailAddress, string emailSubject, string messageBody) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = messageBody; emailMessage.Subject = emailSubject; emailMessage.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(emailAddress)); //if (attachmentFile != null) //{ // var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(attachmentFile); // var attachment = new Windows.ApplicationModel.Email.EmailAttachment( // attachmentFile.Name, // stream); // emailMessage.Attachments.Add(attachment); //} //var email = recipient.Emails.FirstOrDefault<Windows.ApplicationModel.Contacts.ContactEmail>(); //if (email != null) //{ // var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(email.Address); // emailMessage.To.Add(emailRecipient); //} await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async Task ComposeEmail(Windows.ApplicationModel.Contacts.Contact recipient, string messageBody, StorageFile attachmentFile) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = messageBody; if (attachmentFile != null) { var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(attachmentFile); var attachment = new Windows.ApplicationModel.Email.EmailAttachment( attachmentFile.Name, stream); emailMessage.Attachments.Add(attachment); } var email = recipient.Emails.FirstOrDefault <Windows.ApplicationModel.Contacts.ContactEmail>(); if (email != null) { var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(email.Address); emailMessage.To.Add(emailRecipient); } await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
//反馈 private async void reply_Click(object sender, RoutedEventArgs e) { Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.Subject = "Dreaming 反馈"; mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**")); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
private async void WindowPhoneApp_OnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs) { unhandledExceptionEventArgs.Handled = true; var message = unhandledExceptionEventArgs.Message; var stacktrace = unhandledExceptionEventArgs.Exception.StackTrace ?? "null"; #if DEBUG await(new Windows.UI.Popups.MessageDialog(stacktrace, message)).ShowAsync(); #endif var messageDialog = new Windows.UI.Popups.MessageDialog("我们遇到了一些问题,是否愿意将问题告知我们?", "提示"); messageDialog.Commands.Add(new Windows.UI.Popups.UICommand { Id = 0, Label = "是", Invoked = async command => { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage { Subject = "UnhandledException", Body = string.Format("Message:\n{0}\nStackTrace:\n{1}", message, stacktrace) }; emailMessage.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**", "BugReport RSSReader")); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); } }); messageDialog.Commands.Add(new Windows.UI.Popups.UICommand { Id = 1, Label = "否" }); await messageDialog.ShowAsync(); }
public async static Task SendEmail(string emailAddress = null, string subject = null, string messageBody = null, List <StorageFile> attachmentFiles = null) { Windows.ApplicationModel.Email.EmailMessage emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); if (emailAddress != null) { emailMessage.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(emailAddress)); } if (subject != null) { emailMessage.Subject = subject; } if (messageBody != null) { emailMessage.Body = messageBody; } if (attachmentFiles != null) { foreach (StorageFile attachmentFile in attachmentFiles) { var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(attachmentFile); var attachment = new Windows.ApplicationModel.Email.EmailAttachment(attachmentFile.Name, stream); emailMessage.Attachments.Add(attachment); } } await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
public static async Task <bool> ComposeEmailAsync(Windows.ApplicationModel.Contacts.Contact recipient, string subject, string messageBody, string filename, byte[] fileContent) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Subject = subject; emailMessage.Body = messageBody; if (fileContent != null) { StorageFile newFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("tempfile", CreationCollisionOption.ReplaceExisting); await Windows.Storage.FileIO.WriteBytesAsync(newFile, fileContent); var attachment = new Windows.ApplicationModel.Email.EmailAttachment( filename, newFile); emailMessage.Attachments.Add(attachment); } if (recipient != null) { var email = recipient.Emails.FirstOrDefault <Windows.ApplicationModel.Contacts.ContactEmail>(); if (email != null) { var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(email.Address); emailMessage.To.Add(emailRecipient); } } await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); return(true); }
public async void Communicate(Contact kontakt) { //Email Message Objekat var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); //tekst poruke emailMessage.Body = textPoruke; StorageFile attachmentFile = null; //ako neko hoce da doda attachment na poruku moze ucitati file i proslijediti ga ovako //ovo se nikad nece pozvati, samo kao primjer kako se attachment doda if (attachmentFile != null) { var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(attachmentFile); var attachment = new Windows.ApplicationModel.Email.EmailAttachment( attachmentFile.Name, stream); emailMessage.Attachments.Add(attachment); } //prvi mail koji se nadje var email = kontakt.Emails.FirstOrDefault<ContactEmail>(); if (email != null) { //postaviti kao recipient var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(email.Address); //lista, moze se dodati vise kontakata emailMessage.To.Add(emailRecipient); } //poziva napokon api sa spremnom template porukom. Korisnik je naknadno moze izmjeniti koristeci mail client await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void exportData_Click(object sender, RoutedEventArgs e) { Windows.ApplicationModel.Email.EmailMessage emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**")); string messageBody = "Exported DATA - accelerometer"; emailMessage.Body = messageBody; string DataFile = @"Assets\storage.txt"; Windows.Storage.StorageFolder storageFolder = Windows.ApplicationModel.Package.Current.InstalledLocation; Windows.Storage.StorageFile attachmentFile = await storageFolder.GetFileAsync(DataFile); if (attachmentFile != null) { var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(attachmentFile); var attachment = new Windows.ApplicationModel.Email.EmailAttachment( attachmentFile.Name, stream); emailMessage.Attachments.Add(attachment); } await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); /* * IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication(); * //create new file * using (StreamWriter SW = new StreamWriter(new IsolatedStorageFileStream("Info.txt", FileMode.Create, FileAccess.Write, ISF))) * { * string text = "Hi this is the text which will be written to the file and we can retrieve that later"; * SW.WriteLine(text); * SW.Close(); * MessageBox.Show("text has been saved successfully to the file"); * } * * StorageFolder newFolder = KnownFolders.DocumentsLibrary; * StorageFile file = await newFolder.CreateFileAsync("export.txt", CreationCollisionOption.ReplaceExisting); * * string ReadedData = await FileIO.ReadTextAsync(file); * await FileIO.WriteTextAsync(file,ReadedData); */ /* * FileSavePicker savePicker = new FileSavePicker(); * * savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; * savePicker.FileTypeChoices.Add("Plain Text", new List<string>() { ".txt" }); * savePicker.SuggestedFileName = "export_accelerometer"; * * Windows.Storage.StorageFile file = await savePicker.PickSaveFileAndContinue(); * if (file != null) * { * string DataFile = @"Assets\storage.txt"; * Windows.Storage.StorageFolder storageFolder = Windows.ApplicationModel.Package.Current.InstalledLocation; * Windows.Storage.StorageFile sampleFile = await storageFolder.GetFileAsync(DataFile); * Windows.Storage.CachedFileManager.DeferUpdates(sampleFile); * await Windows.Storage.FileIO.WriteTextAsync(sampleFile, sampleFile.Name); * Windows.Storage.Provider.FileUpdateStatus status = * await Windows.Storage.CachedFileManager.CompleteUpdatesAsync(sampleFile); * } */ }
private async void ButtonContact_Click(object sender, RoutedEventArgs e) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = ""; emailMessage.Subject = "BLEExplorer Feedback"; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void FeedBackButton_Click(object sender, RoutedEventArgs e) { Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.Subject = "ZJULife Windows客户端问题反馈与功能建议"; mail.Body = "感谢参与!"; mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**", "cuichao")); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
private async void Button_Click_2(object sender, RoutedEventArgs e) { Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.Subject = "Тема"; mail.Body = "Ваше сообщение"; mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(App.CurrentLawyer.Email, App.CurrentLawyer.Name)); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
private async void buttonFeedback_Click(object sender, RoutedEventArgs e) { Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.Subject = App.Localizer.GetString("MailSubject"); mail.Body = ""; mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**")); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
static public async void ComposeEmail(string messageBody, string filename) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Subject = BalluffConst.Subject + " " + filename; emailMessage.Body = messageBody; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void EnviaEmailClick(object sender, RoutedEventArgs e) { Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.Subject = "Teste de Envio"; mail.Body = "Minha Mensagem de Teste"; mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**", "Alexandre")); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
/// <summary> /// It composes the email from the default app-client installed in the phone. /// </summary> public static async void ComposeEmail() { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = "I liked the following features in this app:"; var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**"); emailMessage.To.Add(emailRecipient); emailMessage.CC.Add(emailRecipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void emailButton_Click(object sender, RoutedEventArgs e) { Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.Subject = "小梦词典意见反馈"; mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**")); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
private async void BtnFeedbackEmailOnClick(object sender, RoutedEventArgs e) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**"); emailMessage.Subject = "[MALClient] - "; emailMessage.To.Add(emailRecipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void SendEmailMessage() { Formateur formateur = DataContext as Formateur; var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(formateur.Courriel)); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
public async void SendEmail() { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Subject = Package.Current.DisplayName; UpdateAppStatus(); emailMessage.Body = AppStatus.ToString(); emailMessage.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**")); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void TextBlock_Tapped(object sender, TappedRoutedEventArgs e) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Subject = "יצירת קשר Romfix - Windows Phone"; var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**"); emailMessage.To.Add(emailRecipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
public static async Task ShowComposeEmail(string to, string subject, string body) { var msg = new Windows.ApplicationModel.Email.EmailMessage(); msg.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(to)); msg.Subject = subject; msg.Body = body; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(msg); }
private async void Feedback_Click(object sender, RoutedEventArgs e) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**"); emailMessage.To.Add(emailRecipient); emailMessage.Subject = $"[BWD] [Feedback] [{GetAppVersion()}]"; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async Task SendEmail(string subject) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**"); emailMessage.To.Add(emailRecipient); emailMessage.Subject = subject; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
/// <summary> /// It composes the email from the default app-client installed in the phone. /// </summary> public static async void ComposeEmail() { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = "I liked the following features in this app:"; var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**"); emailMessage.To.Add(emailRecipient); emailMessage.CC.Add(emailRecipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
public static async Task LaunchEmailApp(string emailAddress, string messageBody) { var message = new Windows.ApplicationModel.Email.EmailMessage(); message.Body = messageBody; var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(emailAddress); message.To.Add(emailRecipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(message); }
private async Task ComposeEmail(string subject, string messageBody) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = messageBody; var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**"); emailMessage.To.Add(emailRecipient); emailMessage.Subject = subject; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
public async void Communicate(List <RegistrovanaMusterija> lista) // kad se ubaci tabela parametar ce biti tipa DbSet { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = textPoruke; foreach (RegistrovanaMusterija kontakt in lista) { var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(kontakt.EmailAdresa); emailMessage.To.Add(emailRecipient); } await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
/// <summary> /// Send and email /// </summary> public async static void ContactEmail(string supportEmail) { string subject = Reporting.AppName; string body = ""; var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = body; var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(supportEmail); emailMessage.To.Add(emailRecipient); emailMessage.Subject = subject; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void LicacaoClick(object sender, RoutedEventArgs e) { /* Windows.ApplicationModel.Chat.ChatMessage msg = new Windows.ApplicationModel.Chat.ChatMessage(); msg.Body = "This is body of demo message."; msg.Recipients.Add("80351686"); await Windows.ApplicationModel.Chat.ChatMessageManager.ShowComposeSmsMessageAsync(msg);*/ Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.Subject = "This is Subject"; mail.Body = "This is body of demo mail"; mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**", "shaomeng")); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
private async void Report(object sender, RoutedEventArgs e) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Subject = "Discord Bug Report"; emailMessage.Body = "Comment:" + Comment.Text + "\n\nDetails:\n" + BugDetails.Text + "\n\nBuild#:6.1.3"; var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**"); emailMessage.To.Add(emailRecipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); CloseButton_Click(); }
public void Send(string text, string to) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage { Body = text }; if (to != null) { var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(to); emailMessage.To.Add(emailRecipient); emailMessage.Subject = AppResources.FromTitle; } Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void Mail(object sender, TappedRoutedEventArgs e) { Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); TextBlock block = (TextBlock)sender; string naam = ""; if (block.Text.Contains("thomas")) { naam = "Thomas Rosseel"; } else if (block.Text.Contains("alex")) { naam = "Alex Dhaenens"; } mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(block.Text, naam)); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
public static async Task SendFileEmail(StorageFile attachmentFile, string messageBody = "\n") { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = messageBody; if (attachmentFile != null) { var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(attachmentFile); var attachment = new Windows.ApplicationModel.Email.EmailAttachment( attachmentFile.Name, stream); emailMessage.Attachments.Add(attachment); } var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(Utils.MAIL_ADDRESS); emailMessage.To.Add(emailRecipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void ComposeEmail(Windows.ApplicationModel.Email.EmailRecipient recipient) { Windows.ApplicationModel.Email.EmailMessage email = new Windows.ApplicationModel.Email.EmailMessage(); email.Subject = "You're PC Build"; foreach (Data d in Accessible.accessible) { if (d != null) { email.Body += d.Component + ": "; email.Body += d.PartName +" "; email.Body += d.PartURL + " ," + Environment.NewLine ; } } email.To.Add(recipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(email); }
private async void ButtonContact_Click(object sender, RoutedEventArgs e) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = ""; emailMessage.Subject = "BLEExplorer Feedback"; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
public static async Task ShowComposeEmail(string to, string subject, string body) { var msg = new Windows.ApplicationModel.Email.EmailMessage(); msg.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(to)); msg.Subject = subject; msg.Body = body; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(msg); }
private async void HyperlinkButton_Click(object sender, RoutedEventArgs e) { //var file = await getAttachment(); //Windows.ApplicationModel.Email.EmailAttachment emailAttachment = new Windows.ApplicationModel.Email.EmailAttachment(file.Name, file);//将文件添加到邮件的附件 Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); // mail.Attachments.Add(emailAttachment);//将附件添加到邮件 mail.Subject = "建议+反馈";//邮件的主题 mail.Body = "";//邮件的内容 mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**", "小新的猫"));//邮件的接受地址和显示名称 await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
private async void button_contact_Click(object sender, RoutedEventArgs e) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**"); emailMessage.To.Add(emailRecipient); emailMessage.Subject = "[Party Tracker]"; await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
/// <summary> /// Launches the email application with a new message displayed. /// </summary> /// <param name="message">The email message that is displayed when the email application is launched.</param> /// <returns>An asynchronous action used to indicate when the operation has completed.</returns> public static Task ShowComposeNewEmailAsync(EmailMessage message) { if (message == null) { throw new ArgumentNullException(); } return Task.Run(() => { #if __ANDROID__ Intent emailIntent = new Intent(Intent.ActionSendto); //emailIntent.SetType("message/rfc822"); emailIntent.SetData(Android.Net.Uri.Parse("mailto:")); emailIntent.PutExtra(Intent.ExtraEmail, RecipientsToStringArray(message.To)); if (message.CC.Count > 0) { emailIntent.PutExtra(Intent.ExtraCc, RecipientsToStringArray(message.CC)); } if (message.Bcc.Count > 0) { emailIntent.PutExtra(Intent.ExtraBcc, RecipientsToStringArray(message.Bcc)); } emailIntent.PutExtra(Intent.ExtraSubject, message.Subject); emailIntent.PutExtra(Intent.ExtraText, message.Body); emailIntent.AddFlags(ActivityFlags.ClearWhenTaskReset); Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity.StartActivity(emailIntent); //Platform.Android.ContextManager.Context.StartActivity(emailIntent); #elif __IOS__ try { UIApplication.SharedApplication.InvokeOnMainThread(() => { MFMailComposeViewController mcontroller = new MFMailComposeViewController(); mcontroller.Finished += mcontroller_Finished; mcontroller.SetToRecipients(BuildRecipientArray(message.To)); mcontroller.SetCcRecipients(BuildRecipientArray(message.CC)); mcontroller.SetBccRecipients(BuildRecipientArray(message.Bcc)); mcontroller.SetSubject(message.Subject); mcontroller.SetMessageBody(message.Body, false); foreach (EmailAttachment a in message.Attachments) { NSData dataBuffer = NSData.FromFile(a.Data.Path); mcontroller.AddAttachmentData(dataBuffer, a.MimeType, a.FileName); } UIViewController currentController = UIApplication.SharedApplication.KeyWindow.RootViewController; while (currentController.PresentedViewController != null) currentController = currentController.PresentedViewController; currentController.PresentViewController(mcontroller, true, null); }); } catch { throw new PlatformNotSupportedException(); } #elif WINDOWS_UWP || WINDOWS_PHONE_APP Windows.ApplicationModel.Email.EmailMessage em = new Windows.ApplicationModel.Email.EmailMessage() { Subject = message.Subject, Body = message.Body }; foreach(EmailRecipient r in message.To) { em.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(r.Address, r.Name)); } foreach(EmailRecipient r in message.CC) { em.CC.Add(new Windows.ApplicationModel.Email.EmailRecipient(r.Address, r.Name)); } foreach (EmailRecipient r in message.Bcc) { em.Bcc.Add(new Windows.ApplicationModel.Email.EmailRecipient(r.Address, r.Name)); } foreach(EmailAttachment a in message.Attachments) { em.Attachments.Add(new Windows.ApplicationModel.Email.EmailAttachment(a.FileName, (Windows.Storage.StorageFile)a.Data)); } return Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(em).AsTask(); #elif WINDOWS_APP /*if (_type10 != null) { } else {*/ // build URI for Windows Store platform // build a uri StringBuilder sb = new StringBuilder(); bool firstParameter = true; if (message.To.Count == 0) { throw new InvalidOperationException(); } else { sb.Append("mailto:" + FormatRecipientCollection(message.To)); } if (message.CC.Count > 0) { if (firstParameter) { sb.Append("?"); firstParameter = false; } else { sb.Append("&"); } sb.Append("cc=" + FormatRecipientCollection(message.CC)); } if (message.Bcc.Count > 0) { if (firstParameter) { sb.Append("?"); firstParameter = false; } else { sb.Append("&"); } sb.Append("bbc=" + FormatRecipientCollection(message.Bcc)); } if (!string.IsNullOrEmpty(message.Subject)) { if (firstParameter) { sb.Append("?"); firstParameter = false; } else { sb.Append("&"); } sb.Append("subject=" + Uri.EscapeDataString(message.Subject)); } if (!string.IsNullOrEmpty(message.Body)) { if (firstParameter) { sb.Append("?"); firstParameter = false; } else { sb.Append("&"); } sb.Append("body=" + Uri.EscapeDataString(message.Body)); } Windows.System.Launcher.LaunchUriAsync(new Uri(sb.ToString())); //} #elif WINDOWS_PHONE // On Phone 8.0 use the email compose dialog EmailComposeTask task = new EmailComposeTask(); if (!string.IsNullOrEmpty(message.Subject)) { task.Subject = message.Subject; } if (!string.IsNullOrEmpty(message.Body)) { task.Body = message.Body; } if (message.To.Count == 0) { throw new InvalidOperationException(); } else { task.To = FormatRecipientCollection(message.To); } if (message.CC.Count > 0) { task.Cc = FormatRecipientCollection(message.CC); } if (message.Bcc.Count > 0) { task.Bcc = FormatRecipientCollection(message.Bcc); } task.Show(); #else throw new PlatformNotSupportedException(); #endif }); }
public async static void sendEmail() { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = ""; emailMessage.Subject = "Feedback"; var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**"); emailMessage.To.Add(emailRecipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }
private async void FeedbackButton_Click(object sender, RoutedEventArgs e) { Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.Subject = "浙大课表 Windows客户端问题反馈与功能建议"; mail.Body = "感谢参与!"; mail.To.Add(new Windows.ApplicationModel.Email.EmailRecipient("*****@*****.**", "cuichao")); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); }
private async void DennisMail_Click(object sender, RoutedEventArgs e) { #if WINDOWS_PHONE_APP //predefine Recipient Windows.ApplicationModel.Email.EmailRecipient sendTo = new Windows.ApplicationModel.Email.EmailRecipient() { Address = "*****@*****.**" }; Windows.ApplicationModel.Email.EmailRecipient sendCc = new Windows.ApplicationModel.Email.EmailRecipient() { Address = "*****@*****.**" }; //generate mail object Windows.ApplicationModel.Email.EmailMessage mail = new Windows.ApplicationModel.Email.EmailMessage(); mail.Subject = "Hi Prog Party!"; mail.Body = "You are great"; //add recipients to the mail object mail.To.Add(sendTo); mail.CC.Add(sendCc); //open the share contract with Mail only: await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(mail); #endif }
// create an email message from email address, message body and subject // then call async emailManager to show the new email UI private async void ComposeEmail(string emailAddress, string messageBody, string messageSubject) { var emailMessage = new Windows.ApplicationModel.Email.EmailMessage(); emailMessage.Body = messageBody; emailMessage.Subject = messageSubject; var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(emailAddress); emailMessage.To.Add(emailRecipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); }