I am building a new web application, and the boss had expressed a preference to have an email sent when something changes, and he wants to be able to click on a link in the email to approve or deny the changes (singly or en masse).
My question: Is it possible to put a POST request in an email, and if so, how? We run exchange internally, and with some work the emails could stay entirely within that, but the normal course of events would send the emails into the wide blue yonder.
My bonus question, which follows logically from the first, is whether it is wise to do so? Should I just have a GET link to a page which allows him to approve or deny requests directly through the application, rather than try to put a POST request in an email?
No, you cannot (in form of clickable link). The HTTP POST requests contains parameters in its body, not in the URL.
First question
Never tried it out but, if you use html in your mails it might be possible to build a
<form method="post" action="yoururl">
environment which will allow him to approve or deny a change. If you do not build a restful webpage you might use a get link which approves/denies a change, something like http://url/change/2323/approve=yes
bonus question
If it is not possible for you to send the <form>
in your email it is okay to provide a GET link. Depending on how many changes your boss has to accept/deny it might be also a good idea to provide him a list of changes he can deny/accept in the . Because I don't like to switch between email app and webbrowser.
来源:https://stackoverflow.com/questions/5416753/can-i-put-both-get-and-post-url-link-in-an-email