I have an idea to do a survey using emails. But have no idea to do it. Can anyone help me with it. I even don't know it is feasible or not.
Here i have an web application which send emails to some users of that app(or any other people) asking about a simple question. It's something like a survey.
Ex: The email which i sent has two buttons. Yes or No. (an answer to a given question). That's all. so I will send this email to many people. And i want them to respond. (Yes or No).
Is there any way to capture the response of the people. I mean if a reader click yes button i want my DB to update it's table according to that. How can I do something like this.
How can i embed something like that button clicking facility to an email. ?
How can i trigger my application about the user events. ?
Is there anyway to achieve a functionality like this ?? please help. Thanks in advance.
The best way to do that is have the buttons forward to a link on your server and register that on your server using php.
Have button Yes forward to "/surveyResult.php?result=yes" and No forward to "/surveyResult.php?result=no" using HTML.
<a href="www.myserver.com/surveyResult.php?result=yes">Yes</a>
<a href="www.myserver.com/surveyResult.php?result=no">No</a>
in your surveyResult.php do something like this:
<?php
$result = $_GET["name"];
[write the result to your mysql-database]
?>
You can use following steps to solve the problem.
Create an action to accept user response (Yes/No Button clicking)
On button click (create a link in email and make it as button using css if required)
On clicking button record the result
Eg:
Your email look like this
Hi User,
Bla bla ....
Please click on any options
<a href="example.com/emailresponse?opt=yes">Yes</a>
<a href="example.com/emailresponse?opt=no">No</a>
Regards,
XXX
Create one Servlet to accept user response
public class EmailResponse extends HttpServlet {
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String option = request.getParameter("opt");
//Save user option into db
}
if you use mvc application(asp.net) Your email template look like this
Dr ....
<a href="www.myserver.com/EmailResponse?result=yes">Yes</a>
<a href="www.myserver.com/EmailResponse?result=no">No</a>
... Thank you
you can create a controller to get email response...
public class EmailResponseController : Controller
{
public ActionResult Index()
{
String result = Request.QueryString["result"];
return View();
}
}