从电子邮件友好的显示名称Web.Config中存储的Smtp [英] Storing Smtp from email friendly display name in Web.Config

查看:258
本文介绍了从电子邮件友好的显示名称Web.Config中存储的Smtp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我存储我的mailsettings在web配置像这样...

I'm storing my mailsettings in the web config like so...

<mailSettings>
    <smtp from="splidge@findremovalcompanies.com">
        <network host="smtp.findremovalcompanies.com" userName="splidge@findremovalcompanies.com" password="password" />
    </smtp>
</mailSettings>

当我创建现在,一个新的

Now when I create a new

var smtp = new SmtpClient();

SMPT有我的证书,他们将默认情况下,从地址splidge@findremovalcompanies.com节省了我不必每次都是这样做的。

smpt has my credentials and will default the from address to splidge@findremovalcompanies.com which saves me from having to do this every time.

MailAddress("splidge@findremovalcompanies.com", "Splidge Master")

但我无法弄清楚如何指定在web.config中友好的显示名称为Splidge大师世界上没有设置呢?

But I cannot figure out how to specify the friendly display name "Splidge Master" in the web.config theres no setting for it?

推荐答案

您可以使用HTML连接codeD&LT;和>(放​​大器; LT;和&放大器; GT;)。从属性,在提供的显示名称

You can use html encoded < and > (&lt; and &gt;) to deliver a display name in the from attribute.

&LT; SMTP deliveryMethod =网络,从=邮件显示名称和放大器; LT; mail@raccoom.net& GT;&GT;

这篇关于从电子邮件友好的显示名称Web.Config中存储的Smtp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆