Click here to Skip to main content
15,886,587 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Guys,

Please help me to add quick action buttons in my gmail. I want to "Add Confirm Subscription button for email verification". I want to use PHP and jquery etc. for this. Please guide.
I'm using below code for this but this don't showing any quick action button.

XML
<?php
    $txtemail = "harishmadaan@xportsoft.com";
    $value = "harish.xportsoft@gmail.com";
    $sub = "Thanks for Contacting Us!" ; //subject of email that is sent
    $headersuser = 'From: '.$txtemail . "\r\nContent-Type: text/html; charset=utf-8" .'X-Mailer: PHP/' . phpversion();
    $mess = '<html>
  <head>
    <script type="application/ld+json">
    {
  "@context": "http://json-ld.org/contexts/person.jsonld",
  "@id": "http://dbpedia.org/resource/John_Lennon",
  "name": "John Lennon",
  "born": "1940-10-09",
  "spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
}
    </script>
  </head>
  <body>
    <p>
      This a test for a Go-To action in Gmail.
    </p>
  </body>
</html>';
    $this_mail = mail($value,$sub,$mess,$headersuser);
    if($this_mail) echo 'sent!';
        else echo error;
?>



Regards,
Harish
Posted
Updated 21-Dec-14 23:07pm
v2
Comments
Sinisa Hajnal 22-Dec-14 3:22am    
Try this: www.google.com

You have to do your own research. Come back when you have a problem with your existing code. In general, wherever you're generating e-mail body, you add the button and provide the link to it. That is all.
Kornfeld Eliyahu Peter 22-Dec-14 8:01am    
Please read here: https://developers.google.com/gmail/markup/reference/one-click-action#confirm_action
You JSON data (in script block) does not fit the requested format/details...
harry madaan 22-Dec-14 23:02pm    
Hello Sir,

I tried this but still not showing any quick action button.
http://grrdjewels.com/mail.php

<head>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"action": {
"@type": "ConfirmAction",
"name": "Approve Expense",
"handler": {
"@type": "HttpActionHandler",
"url": "https://myexpenses.com/approve?expenseId=abc123"
}
},
"description": "Approval request for Johns $10.13 expense for office supplies"
}
</script>
</head> <body> <p> This a test for a Go-To action in Gmail. </p> </body></html>';
$this_mail = mail($value,$sub,$mess,$headersuser);
if($this_mail) echo 'sent!';
else echo error;
?>

Regards,
Harish

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900