【问题标题】:How to replace a button link using SendGrid Api in C#如何在 C# 中使用 SendGrid Api 替换按钮链接
【发布时间】:2017-05-23 18:46:01
【问题描述】:

我的 SendGrid 帐户中有一个事务模板,我学会了如何使用它here,基本上,任何我想更改的 html 标记我都会这样做:

msg.SetTemplateId("0000000-00000-00000-0000-0000000");
msg.AddSubstitution("-name-", "Example User");
msg.AddSubstitution("-city-", "Denver");

问题是,如果我必须在 Button 中放置一个链接,我该怎么做。 ?

<a href="http://www.MyCustomLink.com/"><button style="color:#607D8B; background-
color: white;
border: none;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
padding: 15px 32px;"
type="button">Confirm Account</button>

【问题讨论】:

    标签: c# sendgrid


    【解决方案1】:

    您应该能够简单地将 href 的值设置为替换键。

    例如:

    <a href="-accountConfirmationLink-">
        <button>Confirm Account</button>
    </a>
    

    然后可以替换为

    msg.AddSubstitution("-accountConfirmationLink-", "https://stackoverflow.com");
    

    【讨论】:

    • 谢谢,成功了!
    猜你喜欢
    • 2014-05-19
    • 1970-01-01
    • 2016-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多