# AddMonitor APIs - Mail Servers
This section explains how to use the AddMonitor API to add monitors of the category type '**Mail Server**'. The following monitors are supported:
- [Exchange Server](https://www.manageengine.com/products/applications_manager/help/restapi-mail-servers.html#exchange)
- [Mail Server](https://www.manageengine.com/products/applications_manager/help/restapi-mail-servers.html#mail)
**Supported HTTP methods:** POST
**Allowed roles:** Administrator
## Exchange Server
### Syntax
*https://[HOST]:[PORT]/AppManager/xml/AddMonitor?apikey=[APIKEY]&type=[TYPE]&displayname=[DISPLAYNAME] &host=[HOST]&username=[USERNAME]&password=[PASSWORD]&version=[VERSION]&ServerRole[SE/2019/2016/2013/2010/2007]=[ServerRole]&UsePowershell=[USEPOWERSHELL]&Timeout=[TIMEOUT]*
**Supported HTTP method:** POST
### Request Parameters
The parameters involved in the API request are described below. Also, refer to the [list of common request parameters](https://www.manageengine.com/products/applications_manager/help/addmonitor-api.html#requestparameters).
| Field | Description |
|---|---|
| type | The type of the mail server you want to add. Value should be *Exchange Server*. |
| host | The name of the host where the Exchange server is running. |
| username | The user name for the system in which Exchange server is running. |
| password | The password for the system in which Exchange server is running. |
| version | The Exchange server version. Supported versions are *2003, 2007, 2010, 2013, 2016,* *2019 and SE*. |
| ServerRole2019 | Supported roles are *mbxserver2019* and *edgeserver2019*. (Applicable for both 2019 and SE) |
| ServerRole2016 | Supported roles are *mbxserver2016* and *edgeserver2016*. |
| ServerRole2013 | Supported roles are *mbxserver2013*, *casserver2013* and *edgeserver2013*. |
| ServerRole2010 | Supported roles are *mbxserver2010*, *casserver2010*, *edgeserver2010*, *hubserver2010* and *umserver2010*. |
| ServerRole2007 | Supported roles are *mbxserver2007*, *casserver2007*, *hubserver2007*, *edgeserver2007* and *umserver2007.* |
| UsePowershell | To use powershell for datacollection use “Yes” or else use “No”.This argument is Mandatory. |
| Timeout | The timeout interval in seconds. Value should be greater than *120* seconds. (Applicable only in **Powershell** mode of monitoring) |
### Sample Request
*https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Exchange Server&displayname=apmexchange&host=emp-ex03&username=exchange\admin&password=appman&version=SE&ServerRole2019=mbxserver2019&UsePowershell=Yes&Timeout=120*
## Mail Server
### Syntax
*https://[HOST]:[PORT]/AppManager/xml/AddMonitor?apikey=[APIKEY]&type=[TYPE]&displayname=[DISPLAYNAME] &host=[HOST]&port=[PORT]&username=[USERNAME]&password=[PASSWORD]&version=[VERSION]*
**Supported HTTP method:** POST
### Request Parameters
The parameters involved in the API request are described below. Also, refer to the [list of common request parameters](https://www.manageengine.com/products/applications_manager/help/addmonitor-api.html#requestparameters).
| Field | Description |
|---|---|
| type | The type of the monitor you want to add. Value should be *Mail Server*. |
| host | The name of the host where the mail server is running. |
| port | The SMTP port number |
| emailid | An email id available in the mail server. |
| timeout | The time out value in seconds. |
| mailMsg | The message to appear in the subject of the email. |
| mailSubject | The message to appear in the subject of the mail. |
| smtpauth | Use the **smtpauth=true** option to enable SSL. |
| username
password | If the SMTP server requires authentication, specify the User Name and Password |
| sslEnabled | Use the **SSLEnabled=true** option to enable SSL. |
| tlsEnabled | Use **tlsEnabled=true** to enable TLS for securing data transmission. |
| popenabled | If you with to select POP as the Mail Fetching Server, use **popenabled=true.** |
| fetchEnabled | Specify **fetchEnabled=true** to Enable POP or IMAP Mail Fetching Server. |
| popPort | If the POP/Imap service is in a different host, specify its POP/Imap Port where POP service runs. |
| popUserName
popPassword | If the POP/Imap service is in a different host, provide the authentication details User Name and Password for the POP service. |
| popSSLEnabled | Use **popSSLEnabled=true** to enable SSL for securing data transmission in POP/Imap |
| popTLSEnabled | Use **poptlsEnabled=true** to enable TLS for securing data transmission in POP/Imap. |
| fetchType | Select the Mail Fetching Server. Values are *POP* and *IMAP.* |
| fsHost | The Mail Fetching Server POP/IMAP Host. |
| fsport | The Mail Fetching Server POP/IMAP port. |
| fsSSLEnabled | Use the **fsSSLEnabled=true** option to enable SSL. |
| fsTLSEnabled | Use the **fsTLSEnabled=true** option to enable TLS. |
### Sample Request
*https://apm-prod-server:8443/AppManager/xml/AddMonitor?apikey=aaaaaabbbbbbccccccddddddeeeeee&type=Mail Server&host=smtp&displayname=apmmail&port=25&emailid=myesura@zohocorp.com&timeout=15&mailMsg=Testing mail server.*