问题标签 [mailmessage]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - MailMessage c# - 如何使其成为 HTML 并添加图像等?
这就是我目前发送测试电子邮件的方式。我如何制作这个 html 并能够通过添加图像等使发送的电子邮件看起来更好?
谢谢
c# - 使用 MailMessage 类
我正在使用 MailMessage 类发送电子邮件
当我创建新的 MailMessage 对象时,它会使用 fromAddr 自动获取主机。例如,如果我的 fromaddress 是 chamara@pindoc.com.au 它假定主机为 pindoc.com.au 但我有不同的主机名称.所以主机名是错误的。我认为因为我收到以下错误。
{“邮箱不可用。服务器响应为:5.7.1 无法中继”} System.Exception {System.Net.Mail.SmtpFailedRecipientException}
我该如何解决这个问题?
asp.net - MailMessage 不会发送给超过 2 个收件人?
在 ASP.NET 中,我正在发送 MailMessage,但它不会通过。我正在使用的代码是
当我这样做时,我永远不会收到我的邮件。但是,如果我使用此代码:
每次发送都很好。有人知道这里发生了什么吗?所有 3 封电子邮件都是相同的(出于测试目的),并且在调试时已被验证为正确。我尝试为第三个插入不同的电子邮件地址,但仍然没有通过。我可能遗漏了一些明显的东西......
编辑:每个人都告诉我单独添加它们,如果每个人都同意,这可能是个好建议。我以前没有这样做的原因,我只是用三个单独的地址再次尝试,但没有一个被发送。如果应该可行的话,也许我还有另一个问题?
编辑:对于将来遇到同样问题的任何人,这就是我所做的。创建 MailMessage 时,我没有使用任何参数创建它,而是单独指定了 From 参数。我将 From 和所有 To 电子邮件都new MailAddress()
包含在内,所有这些更改的组合似乎都有效。
.net - 为什么 System.Net.Mail.MailMessage 实现 IDisposable
所以我一直在使用System.Net.Mail.MailMessage
对象来发送电子邮件SmtpClient
一段时间了。我注意到某个地方MailMessage
实现了IDisposable
,所以我总是在一个using
块中使用它。
从元数据中,您可以看到有关执行的信息MailMessage
但我想知道,为什么MailMessage
实施IDisposable
?它似乎与网络相关的项目没有任何关系,因为SmtpClient
处理所有这些。
可能是由于可能持有附加文件的文件句柄吗?还有什么我忘记了吗?
c# - Erroneous email receiver display when using German umlauts and a comma in name
Using the MailMessage
class in .NET 4, I found an issue today that I'm unable to resolve so far. Please see the following code:
This is a simple snippet so send an SMTP message. Mutually trying the lines /*1*/
, /*2*/
and /*3*/
, the behavior differs:
Whenever a receiver ("To") name contains a German umlaut (i.e. "Ä", "Ö" or "Ü") and a comma (i.e. ","), the receiver sees damaged text in the email message he receives:
As you can see in the above screenshot (taken from Outlook 2010), there is a cryptic "=?utf-8?Q?M=C3=BCller" in the "To:" line.
Leaving out the comma or removing the German umlaut fixes this. I've tried both Exchange 2003 and hmailserver to get the same result.
My question is:
Is anyone aware of this behaviour and has a solution to it?
Update 1:
As suggested by user Adam Maras, I fired up Microsoft Network Monitor while sending the email message.
To me, it seems that the MailMessage
class (or the SmtpClient
class?) is already doing it wrong:
attachment - 使用 MailMessage 的 LinkedResources 嵌入文档
我正在使用以下代码将图像嵌入到我的 MailMessage 中。我想要做的是将文档(pdf 或 docx)嵌入到电子邮件中。
我已经尝试使用指向 href="cdi:myDoc.pdf" 的链接的超链接,但这不起作用。我也尝试过使用 MailMessage.Attachments.Add() 但在附件部分添加文档,而不是在消息中嵌入文档。
任何人如何在邮件中嵌入文档?我知道 Outlook 能够将附件放在邮件正文中,但我不知道如何通过 mailMessage 进行操作。
谢谢苏珊
c# - system.net.mail 中的 C# smtp 配置
我有一个发送通知电子邮件的小型 WinForms 应用程序。它适用于 Outlook 客户端,但如果输入 gmail/yahoo/windowslive 地址,则会出现炸弹。我看过很多使用 system.web.mail 和架构的帖子,但是 Visual Studio 2010 在尝试使用它时给了我一个错误(我假设是因为 .Net 2.0)。是否可以将我的 smtp 客户端代码配置为中继到所有这些电子邮件提供商?
我将 system.net.mail 与 MailMessage 一起使用。我的配置代码如下...
.net - MailMessage 从测试 PC 发送 ok 但不是开发服务器
当我在本地测试时,我能够将 smtp 消息发送到第 3 方 smtp 服务器,但当我将此代码移植到我们的开发服务器时却不能。当我在那里尝试时,我真的不知道,但我认为它没有发出请求。我运行了 firebug、fiddler 并没有从我的代码中看到发送邮件请求的请求。
除了测试主机的 smtp 端点,我正在发送这个 smtp 请求以确保它对我们开放(确实如此),我一直试图弄清楚为什么相同的代码在我的机器上有效,但在我们的 Windows Server 2008 R2 上无效开发箱。
c# - MailAddress 构造函数中的多个地址
我试图添加多个这样的地址。
但会抛出错误