Since: API level 11
public class

EmailAccount

extends Object
implements Parcelable
java.lang.Object
   ↳ com.samsung.android.knox.accounts.EmailAccount

Deprecated in API level 27

Class Overview

This class contains all the account information for a given email account

Since
API level 11
MDM 5.0

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public String emailAddress Email Address
public String incomingProtocol InComing Protocol
public boolean incomingServerAcceptAllCertificates Accept All Certificates when InComing Server
public String incomingServerAddress InComing Server Address
public String incomingServerLogin InComing Server Login
public String incomingServerPassword InComing Server PassWord
public int incomingServerPort InComing Server Port
public boolean incomingServerUseSSL use SSL when InComing Server
public boolean incomingServerUseTLS use TLS when InComing Server
public boolean isNotify Notify
public String outgoingProtocol OutGoing Protocol
public boolean outgoingServerAcceptAllCertificates Accept All Certificates when Outgoing Server
public String outgoingServerAddress OutGoing Server Address
public String outgoingServerLogin OutGoing Server Login
public String outgoingServerPassword OutGoing Server PassWord
public int outgoingServerPort OutGoing Server Port
public boolean outgoingServerUseSSL use SSL when Outgoing Server
public boolean outgoingServerUseTLS use TLS when Outgoing Server
public String signature Signature to use with the account
Public Constructors
EmailAccount()
EmailAccount(String emailAddress, String inComingProtocol, String inComingServerAddress, int inComingServerPort, String inComingServerLogin, String inComingServerPassword, String outGoingProtocol, String outGoingServerAddress, int outGoingServerPort, String outGoingServerLogin, String outGoingServerPassword)

Struct to add a new email account.

[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public String emailAddress

Since: API level 11

Email Address

Since
API level 11
MDM 5.0

public String incomingProtocol

Since: API level 11

InComing Protocol

Since
API level 11
MDM 5.0

public boolean incomingServerAcceptAllCertificates

Since: API level 11

Accept All Certificates when InComing Server

Since
API level 11
MDM 5.0

public String incomingServerAddress

Since: API level 11

InComing Server Address

Since
API level 11
MDM 5.0

public String incomingServerLogin

Since: API level 11

InComing Server Login

Since
API level 11
MDM 5.0

public String incomingServerPassword

Since: API level 11

InComing Server PassWord

Since
API level 11
MDM 5.0

public int incomingServerPort

Since: API level 11

InComing Server Port

Since
API level 11
MDM 5.0

public boolean incomingServerUseSSL

Since: API level 11

use SSL when InComing Server

Since
API level 11
MDM 5.0

public boolean incomingServerUseTLS

Since: API level 11

use TLS when InComing Server

Since
API level 11
MDM 5.0

public boolean isNotify

Since: API level 11

Notify

Since
API level 11
MDM 5.0

public String outgoingProtocol

Since: API level 11

OutGoing Protocol

Since
API level 11
MDM 5.0

public boolean outgoingServerAcceptAllCertificates

Since: API level 11

Accept All Certificates when Outgoing Server

Since
API level 11
MDM 5.0

public String outgoingServerAddress

Since: API level 11

OutGoing Server Address

Since
API level 11
MDM 5.0

public String outgoingServerLogin

Since: API level 11

OutGoing Server Login

Since
API level 11
MDM 5.0

public String outgoingServerPassword

Since: API level 11

OutGoing Server PassWord

Since
API level 11
MDM 5.0

public int outgoingServerPort

Since: API level 11

OutGoing Server Port

Since
API level 11
MDM 5.0

public boolean outgoingServerUseSSL

Since: API level 11

use SSL when Outgoing Server

Since
API level 11
MDM 5.0

public boolean outgoingServerUseTLS

Since: API level 11

use TLS when Outgoing Server

Since
API level 11
MDM 5.0

public String signature

Since: API level 11

Signature to use with the account

Since
API level 11
MDM 5.0

Public Constructors

public EmailAccount ()

Since: API level 11

public EmailAccount (String emailAddress, String inComingProtocol, String inComingServerAddress, int inComingServerPort, String inComingServerLogin, String inComingServerPassword, String outGoingProtocol, String outGoingServerAddress, int outGoingServerPort, String outGoingServerLogin, String outGoingServerPassword)

Since: API level 11

Struct to add a new email account.

Parameters
emailAddress Email address of the email account
inComingProtocol Incoming server protocol
inComingServerAddress Incoming server address
inComingServerPort Incoming server port number
inComingServerLogin Incoming server login/username
inComingServerPassword Incoming server password
outGoingProtocol Outgoing server protocol
outGoingServerAddress Outgoing server address
outGoingServerPort OutgGoing server port number
outGoingServerLogin Outgoing server login/username
outGoingServerPassword Outgoing server password

 long  accountId = -1;

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 EmailAccountPolicy  emailAccountPolicy = edm.getEmailAccountPolicy();

  try {

          accountId = emailAccountPolicy.addNewAccount(new EmailAccount(

             "testemail@gmail.com","pop3","pop.gmail.com", 995,

             "testemail@gmail.com", null,"smtp", "smtp.gmail.com",465,

             "testemail@gmail.com",null));



          if(accountId >= 0){

              Log.d(TAG," Adding a new email account has succeeded!");

              // Administrator needs to call sendAccountsChangedBroadcast() API

              // to notify regarding email account addition.

              emailAccountPolicy.sendAccountsChangedBroadcast();



          }else{

              Log.d(TAG," Adding a new email account failed.");

          }

  } catch(SecurityException e) {

      Log.w(TAG,"SecurityException: "+e);

  }

 
For Container:

 long  accountId = -1;

 // When you create container successfully, containerID will be returned via intent.

 // Use this containerID in below API.

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);

 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);

 EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy();

  try {

          accountId = emailAccountPolicy.addNewAccount(new EmailAccount(

             "testemail@gmail.com","pop3","pop.gmail.com", 995,

             "testemail@gmail.com", null,"smtp", "smtp.gmail.com",465,

             "testemail@gmail.com",null));



          if(accountId >= 0){

              Log.d(TAG," Adding a new email account has succeeded!");

              // Administrator needs to call sendAccountsChangedBroadcast() API

              // to notify regarding email account addition.

              emailAccountPolicy.sendAccountsChangedBroadcast();



          }else{

              Log.d(TAG," Adding a new email account failed.");

          }

  } catch(SecurityException e) {

      Log.w(TAG,"SecurityException: "+e);

  }

 
Since
API level 11
MDM 5.0
Multiuser Environment
User Scope