Send Mail APIs

You can send emails to the email IDs of other records in Zoho CRM only

  • From your account's primary email and the organization's email addresses (if you have not configured Email under Setup).

  • From the configured email addresses, email aliases, and the organization's email address (if you have configured IMAP/POP/GMail). Refer to Zoho Mail Setup to learn how to setup Email for your account.

Get the list of allowed "from" addresses

Purpose

To get the list of email addresses that you can send emails from.

Request Details

Request URL

All - {api-domain}/crm/{version}/settings/emails/actions/from_addresses

Scope

scope=ZohoCRM.settings.emails.READ

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v2.1/settings/emails/actions/from_addresses"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
4.0.04.x
Copied//Get instance of SendMailOperations Class
$sendMailOperations = new SendMailOperations();
//Call getEmailAddresses method that takes ParameterMap instance as parameter
$response = $sendMailOperations->getEmailAddresses();
Copied<?php
class GetFromAddresses{
    
    public function execute(){
        $curl_pointer = curl_init();
        
        $curl_options = array();
        $url = "https://www.zohoapis.com/crm/v2.1/settings/emails/actions/from_addresses";
    
        $curl_options[CURLOPT_URL] = $url;
        $curl_options[CURLOPT_RETURNTRANSFER] = true;
        $curl_options[CURLOPT_HEADER] = 1;
        $curl_options[CURLOPT_CUSTOMREQUEST] = "GET";
        $headersArray = array();
        $headersArray[] = "Authorization". ":" . "Zoho-oauthtoken " ."1000.30f3a589XXXXXXXXXXXXXXXXXXX4077.dc5XXXXXXXXXXXXXXXXXXXee9e7c171c";
        $curl_options[CURLOPT_HTTPHEADER]=$headersArray;
        
        curl_setopt_array($curl_pointer, $curl_options);
        
        $result = curl_exec($curl_pointer);
        $responseInfo = curl_getinfo($curl_pointer);
        curl_close($curl_pointer);
        list ($headers, $content) = explode("\r\n\r\n", $result, 2);
        if(strpos($headers," 100 Continue")!==false){
            list( $headers, $content) = explode( "\r\n\r\n", $content , 2);
        }
        $headerArray = (explode("\r\n", $headers, 50));
        $headerMap = array();
        foreach ($headerArray as $key) {
            if (strpos($key, ":") != false) {
                $firstHalf = substr($key, 0, strpos($key, ":"));
                $secondHalf = substr($key, strpos($key, ":") + 1);
                $headerMap[$firstHalf] = trim($secondHalf);
            }
        }
        $jsonResponse = json_decode($content, true);
        if ($jsonResponse == null && $responseInfo['http_code'] != 204) {
            list ($headers, $content) = explode("\r\n\r\n", $content, 2);
            $jsonResponse = json_decode($content, true);
        }
        var_dump($headerMap);
        var_dump($jsonResponse);
        var_dump($responseInfo['http_code']);
        
    }
    
}
(new GetFromAddresses())->execute();

Sample Response

Copied{
    "from_addresses": [
        {
            "user_name": "Patricia Boyle",
            "type": "primary",
            "email": "pat.boyle@abc.com",
            "id": null
        },
        {
            "user_name": "user2",
            "type": "imap",
            "email": "email2@gmail.com"
        },
        {
            "user_name": "user3",
            "type": "imap",
            "email": "email3@gmail.com"
        },
        {
            "user_name": "J Smith",
            "id": "3652397000002381001",
            "type": "org_email",
            "email": "j.smith@abc.com"
        }
    ]
}