This article describes how you can use Wisej.NET Hybrid to open the default email app. When the email app is loaded, it can be set to create a new email with the specified recipients, subject, and body.
Get started
To access the email functionality, the following platform specific setup is required.
Android
If your project's Target Android version is set to Android 11 (R API 30) or higher, you must update your Android Manifest with queries that use Android's package visibility requirements.
In the Platforms/Android/AndroidManifest.xml file, add the following queries/intent
nodes in the manifest
node:
iOS / Mac Catalyst
Apple requires that you define the schemes you want to use. Add the LSApplicationQueriesSchemes
key and schemes to the Platforms/iOS/Info.plist and Platforms/MacCatalyst/Info.plist files:
Using Email
The Email functionality works by providing the email information as an argument to the Compose method. In this example, the EmailMessage type is used to represent the email information:
File attachments
When creating the email provided to the email client, you can add file attachments. The file type (MIME) is automatically detected, so you don't need to specify it. Some mail clients may restrict the types of files you send, or possibly prevent attachments altogether.
Use the EmailMessage.Attachments collection to manage the files attached to an email.
The following example demonstrates adding an image file to the email attachments.
Platform Differences
Android
Not all email clients for Android support EmailBodyFormat.Html, since there is no way to detect this, we recommend using EmailBodyFormat.PlainText when sending emails.
iOS
Both EmailBodyFormat.Html and EmailBodyFormat.PlainText are supported.
To use the email API on iOS, you must run it on a physical device. Otherwise, an exception is thrown.
Windows
Only supports EmailBodyFormat.PlainText as the EmailMessage.BodyFormat. Attempting to send an Html
email throws the exception: FeatureNotSupportedException.
Not all email clients support sending attachments.
Source
Last updated