Hello,
Welcome to our Microsoft Q&A platform!
According to the posted code, you seem not to attach the file when sending the email. You need to pass the file uri instead of the file name.
//create the file with the path first
var uri = FileProvider.GetUriForFile(this, PackageName + ".fileprovider", file);
var sharingIntent = new Intent();
sharingIntent.SetAction(Intent.ActionSend);
sharingIntent.SetType("image/*");
sharingIntent.PutExtra(Intent.ExtraSubject, "contact_subject");
sharingIntent.PutExtra(Intent.ExtraText, content);
sharingIntent.PutExtra(Intent.ExtraStream, uri);
StartActivity(Intent.CreateChooser(sharingIntent, title));
It requires to config the FileProvider in AndroidManifest.xml.
<provider android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.