public final class

EmailManager

extends Object
java.lang.Object
   ↳ com.neomades.io.mail.EmailManager

Class Overview

This class allow to send Email messages using native email clients.
Due to platforms limitations, you can not get confirmation on whether the email was sent or not.

How to send email

Here is a basic code sample showing how to send an email message with NeoMAD :

 // Create an Email instance and define its content.
 // You can chain setters as they all return the Email instance.
 Email email = new Email().setTo("newbie@neomades.com").setCc("john.doe@neomades.com;jane.doe@neomades.com")
 		.setSubject("NeoMAD is a great tool !")
 		.setBody("You should definitely try NeoMAD, it's a great tool for mobile developpers.");

 // Set an action chooser title for Android platforms
 EmailManager.getDefault().setActionChooserTitle("Select an email client :");

 // Send the email
 EmailManager.getDefault().send(email);
 

Summary

Public Methods
static EmailManager getDefault()
Returns the default EmailManager.
static boolean isEmailAvailable()
For iOS, returns true if the device is configured to send mail.
void send(Email email)
Open a native email client with a new prefilled message using the provided Email parameter.
EmailManager setActionChooserTitle(String actionChooserTextDialog)
Only for Android.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static EmailManager getDefault ()

Returns the default EmailManager.

Returns
  • the default EmailManager

public static boolean isEmailAvailable ()

For iOS, returns true if the device is configured to send mail.

Cross-Platform considerations

On Android, this method will always return true. The system will open an application chooser and will ask for email account configuration if necessary.

Returns
  • true if mails can be sent (or if the platform handles email account configuration automatically)

public void send (Email email)

Open a native email client with a new prefilled message using the provided Email parameter.
After the email has been sent, returns to the current Screen.

Parameters
email the message to send.

public EmailManager setActionChooserTitle (String actionChooserTextDialog)

Only for Android.

Parameters
actionChooserTextDialog string used only on Android platforms to define the title of the intent chooser dialog.
Returns
  • the current manager