I am sending an email to outlook using php with powershell at the backend. I want to fetch an approve or reject response from that mail and have to store that response in the database. So, there will be two buttons, APPROVE REJECT in the mail sent to outlook,and when the user clicks on anyone of them, the respective decision must get stored in the database.
Any idea about the technology that should be used for making all this happen?
A possible solution is develop an Outlook add-in which can add buttons on the ribbon for mail items. In the button click event handler you/users can save an Outlook item to the database. See Walkthrough: Creating Your First Application-Level Add-in for Outlook to get started quickly.
To customize the Ribbon UI VSTO provides two possible ways:
Step wise Solution to your problem:
Create Email with info about your records: Place 2 buttons/links with unique_id of your db table #Replace localhost with your site name eg. Approve link:http//localhost/response_of_email_reader.php?record_ID_status='11231232_approved'"
Reject link:http//localhost/response_of_email_reader.php?record_ID_status='11231232_rejected'"
If you dont want to reveal the record number, you can encrypt and then send. Its decryption you should store in some other table in that case.
2 Whenever a user will any button, "response_of_email_reader.php" will act as a listener in this.
It should contain something like this:
if(isset($GET['record_ID_status'])){
$tmp=$GET['record_ID_status']
$tmp=explode("_", $tmp);
$record_id = $tmp[0;]
$status = $tmp[1;]
#RUN THE UPDATE QUERY ON DB
Update mytable set status="$status" WHERE unique_record_column="$record_id"
}
I hope it helps you