Example #1
0
        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);
                }
            }));
        }
Example #2
0
 public static Task ComposeAsync(this IEmail email, string subject, string body, params string[] to) =>
 email.ComposeAsync(new EmailMessage(subject, body, to));
Example #3
0
 public static Task ComposeAsync(this IEmail email) =>
 email.ComposeAsync(null);