我使用SmtpMail让用户转发网站内容。用户填写包含名字和电子邮件的表格。
发送的电子邮件具有完整的电子邮件地址,作为收件人收件箱中的“发件人地址”(他们看到发件人:[email protected],而我希望他们看到发件人:Joe)。
如何将“发件人地址”格式化为用户输入的名字?
谢谢!
最佳答案
MailAddress类有一个可选参数,您可以在其中指定显示名称。我假设它存在时就会被使用。
Dim from As MailAddress = New MailAddress("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4e2c2b200e2d21203a213d21602d2123" rel="noreferrer noopener nofollow">[email protected]</a>", "Ben Miller")
Dim to As MailAddress = New MailAddress("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="81ebe0efe4c1e2eeeff5eef2eeafe2eeec" rel="noreferrer noopener nofollow">[email protected]</a>", "Jane Clayton")
Dim message As MailMessage = New MailMessage(from, to)
关于vb.net - SmtpMail - 将 "From Address"更改为名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4018427/