In previous blog post we’ve seen how we can use plugins to send text messages and use same API across platforms without bothering about individual platform specific APIs. In this blog post we’ll continue to discuss plugins and see how we can send Email messages.
In case of Windows Phone, we can use EmailManager to send EmailMessage. The code will look like:
For Android, there is no class as such which can handle email messaging. Rather, we use something called as Intent.
In case of iOS, we use built-in controller to pass parameters which can populate the email message and later-on send it.
Now, lets see how we can implement this feature in Xamarin.Forms using Plugins. The plugin which we used last time, is feature rich and also included capability to send emails. Refer Messaging Plugin for Xamarin and Windows in your applications and modify the code as shown below. Depending on the platform on which the code is executing, it will internally call the platform specific APIs.
Once again, using this plugin it becomes easy to send Email on Android, iOS and Windows Phone.