带有批准链接的电子邮件

本文关键字:电子邮件 链接 | 更新日期: 2023-09-27 18:30:29

我有一个供应商,他登录到网站并填写表格,并在提交时向管理员发送电子邮件,但这只有在管理员(收到此电子邮件的人)允许时才会添加到"批准"列表中。我想知道如何在电子邮件中发送链接,当该人单击链接时,它会批准此特定供应商的此表格......目前我有这个:

MailingManager.SendEmail(toAddresses, fromAddress, "Approval", "<a href=http://localhost:53048/Website/Site/PurchasersSuppliers/CreateSuppliers.aspx?SectionID=537  </a>; 
This is an email to ask for confirmation, null, templateID);

所以我知道您可以将HTML添加到邮件正文中。但是我如何获得它,以便在单击正文中的链接时,我可以获得某种方式向数据库指示此特定记录是否已获得批准?

带有批准链接的电子邮件

你可以按如下方式传递HTML代码

MailingManager.SendEmail(toAddresses, fromAddress, "Approval", "<a href='http://localhost:53048/Website/Site/PurchasersSuppliers/CreateSuppliers.aspx?SectionID=537&UserID=12&SupplierID=2'>This is an email to ask for confirmation  </a>", null, templateID);

当您在邮件中发送链接,然后从供应商打开的电子邮件链接,它会重定向到您的申请页面CreateSuppliers.aspx。

现在,在 CreateSuppliers.aspx 页面上,您可以在页面加载本身中处理事件。 您可以在查询字符串中传递更多参数来完成任务。

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        DoSomething(Request["SectionID"]);
    }
}
private void DoSomething(string SectionID)
{ 
    // make database call against SectionID and fetch whether its approved or not.
}

希望这对你有帮助。