Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

App Crashing while sending email attachment using Xamarin essentials

$
0
0

Hi Team,

App is crashing after launching email client with attachment (more than 400 kb) in android device using xamarin essential for email client.

Tried in native implementation as well, there also same result, sending txt file attachment.(using dependency service)

Please find the attached screenshot for your reference. Expecting the valuable suggestions.thanks in advance.

Below code for sending email:

   List<string> recipients = new List<string>() { recipient };
            var message = new Xamarin.Essentials.EmailMessage
            {
                Subject = subject,
                To = recipients,
                Body = "Body"
            };
            var logFile = Path.Combine(FileSystem.CacheDirectory, FileName);
            File.WriteAllBytes(logFile, Encoding.ASCII.GetBytes(LogFileText));
            message.Attachments.Add(new Xamarin.Essentials.EmailAttachment(logFile));
            AddAttachments(message);
           ** await Email.ComposeAsync(message);** // after executing this app will crash.

Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>