Plugin 02: Email Messaging

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:

image.png

For Android, there is no class as such which can handle email messaging. Rather, we use something called as Intent.

image1.png

In case of iOS, we use built-in controller to pass parameters which can populate the email message and later-on send it.

image.png

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.

image.png

Once again, using this plugin it becomes easy to send Email on Android, iOS and Windows Phone.

Namaste
Mayur Tendulkar

Advertisements

Published by

Mayur Tendulkar

Working as a Program Manager for Xamarin in Microsoft. More details at: https://about.me/tendulkar

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s