i am sending a mail from windows application. in that content i have a word "Acknowledge" as link.. If the user opens the mail in Outlook and click acknowledge i want to capture the date and time.and save it in my table. this is my requirement
i have done code in HTML in codebehind and getting the mail with acknowledge link but after that.. no idea to get the date & time in click event of "Acknowledge" link and update the same in table.
i am using C# .net 4.0
any ideas will be helpful ?
Below is the code i tried
MailMessage mail = new MailMessage();
mail.To.Add(emailid);
mail.From = new MailAddress(emailid);
mail.Subject = "Invoice No : " + InvoiceNumberTextBox.Text + "";
string Body = @"<p>Dear Team,</p><p> Please find the Invoice Details below :-</p><p><b><u>INVOICE DETAILS</u></b></p>
<table style=""height:60px;width:610px"">
<tr><td style=""width:250px;"">Invoice Number: " + InvoiceNumberTextBox.Text + @"</td></tr>
<tr><td style=""width:250px;"">Company Name: " + HRPartyNameTextBox.Text + @"</td></tr>
<tr><td style=""width:250px;"">Amount: " + HRAmountTextBox.Text + @"</td></tr>
<tr><td style=""width:250px;"">Joint Venture: " + JointVentureComboBox.Text + @"</td></tr>
<tr><td style=""width:250px;"">Request Raised On: " + chequeReqdate + @"</td></tr>
</table>
<br/><br/>
<a href="">Acknowledge</a>
<p>Regards</p>
<center>***** This is auto generated mail, please do not reply to this mail *****</center>";
mail.Body = Body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "mailrelay.XXXX.com";
smtp.Port = 25;
smtp.UseDefaultCredentials = true;
smtp.Credentials = new System.Net.NetworkCredential("emailid", "");
smtp.EnableSsl = true;
smtp.Send(mail);
}
catch (Exception sm)
{
sm.ToString();
}
It is not possible to execute code on the client machine to get the date and time when Acknowledged
is clicked (which is what I think you're asking).
The best solution would be to generate a URL with a GUID, or some type of unique identifier that you already have, and pass it to a page on your server to process it.
Link click > web page receives URL with unique ID > update DB accordingly