private static async Task SendOnEmail(SQLite.TableQuery <Model.Errors> notices) { var message = new Xamarin.Essentials.EmailMessage { Subject = "Отчет об ошибках", Body = "Здесь вы можете добавить описание вашей проблемы (если она есть). Мы постараемся вам помочь", To = new List <string>() { "*****@*****.**" }, BodyFormat = Xamarin.Essentials.EmailBodyFormat.PlainText }; var fn = "logs.txt"; var file = System.IO.Path.Combine(Xamarin.Essentials.FileSystem.CacheDirectory, fn); string log = Api.Funcs.PhoneModel + ":" + Environment.NewLine + Environment.NewLine + string.Join(Environment.NewLine, notices.Select(er => er.Name + Environment.NewLine + er.Method + Environment.NewLine + er.Params + Environment.NewLine)); System.IO.File.WriteAllText(file, log); message.Attachments.Add(new Xamarin.Essentials.EmailAttachment(fn)); await Xamarin.Essentials.Email.ComposeAsync(message); //*/ }
public Task SendEmail(string subject, string body, IEnumerable <string> recipients) { return(_mainThread.InvokeOnMainThreadAsync(async() => { var message = new Xamarin.Essentials.EmailMessage { Subject = subject, Body = body, To = recipients.ToList() }; try { await _email.ComposeAsync(message).ConfigureAwait(false); } catch (Xamarin.Essentials.FeatureNotSupportedException) { await DisplayAlert("No Email Client Found", "We'd love to hear your fedback!\[email protected]", "OK").ConfigureAwait(false); } })); }