How to track the email status like delivered, Opened,Clicked ,Bounced,Blocked for an email sent with GMAIL API. Previously we have used SendGrid for sending the email and tracking the emails. In sendgrid we have used a callback URL for tracking the emails.
Now we have switched to Gmail API for the mail sending functionality. The Email Log Search functionality in Google admin console is the tool used by the admin to track the emails. Do the google provide any API to track the emails programmatically?
PHP Code For Gmail API call
$this->load->library('Google');
$this->google->setScopes(["https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.compose",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/gmail.send"]);
$this->google->useApplicationDefaultCredentials();
$this->google->setSubject($user);
$this->google->setApplicationName("Quickstart");
$service = new Google_Service_Gmail( $this->google);
// Main Process
$msg = $this->createMessage($sender, $to, $subject, $messageText);
$res = $this->sendMessage($service, $sender, $msg);
We could read the email by $service->users_messages->get method in PHP SDK. But we couldn't track the email status like Opened,Clicked ,Bounced,Blocked.