SmtpMail - 更改“发件人地址”命名
我使用 SmtpMail 供用户转发网站内容。用户填写包含名字和电子邮件的表格。
发送的电子邮件具有完整的电子邮件地址作为收件人收件箱中的“发件人地址”(他们看到发件人:[电子邮件受保护],而我希望他们看到发件人:乔)。
如何将“发件人地址”格式化为用户输入的名字?
谢谢!
I use SmtpMail for users to forward site content. The user fills out a form which includes first name and email.
The email sent has the full email address as the "From address" in the recipients inbox (they see From: [email protected] while I want them to see From: Joe).
How can I format the "From address" to be the users inputted first name?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
MailAddress 类有一个可选参数,您可以在其中指定显示名称。我假设它存在时会被使用。
The MailAddress class has an optional parameter where you can specify a display name. I assume it will be used when present.
这一直对我有用:
This has always worked for me:
我最终使用的格式是:
mailer.From = name & “<” &电子邮件发送器和">"
这会格式化发件人地址以包括姓名和电子邮件地址。它将在大多数电子邮件客户端中显示为
Joe <[email protected]< /a>>
。这是我想要的结果。感谢 Knslyr 和 lincolnk 的支持。
The format I ended up using was:
mailer.From = name & "<" & emailer & ">"
This formats the from address to include Name as well as Email address. It will be displayed in most email clients as
Joe <[email protected]>
. This was my desired outcome.Thank you Knslyr and lincolnk for the support.
此方法显示“Rameez”而不是“[电子邮件受保护]”
this method displays 'Rameez' instead of '[email protected]'