问题标签 [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.

0 投票
2 回答
1369 浏览

c# - 更改正在发送的电子邮件的颜色

在 Outlook 中,如果您转到...

工具 > 组织 > 使用颜色(选项卡)

...您可以更改收件箱中符合条件(发送自、发送至等)的电子邮件的颜色。

有没有办法用 C# 以编程方式做到这一点?

目前,我有一个与示例类似的简单 MailMessage 对象。

我的要求是这样的:

  • 更改某人收到的电子邮件的颜色,使其看起来更紧急

我知道您也可以使用 MailPriority.High 但这还不够好。

0 投票
5 回答
27591 浏览

c# - MailMessage c# - 如何使其成为 HTML 并添加图像等?

这就是我目前发送测试电子邮件的方式。我如何制作这个 html 并能够通过添加图像等使发送的电子邮件看起来更好?

谢谢

0 投票
3 回答
3489 浏览

c# - 使用 MailMessage 类

我正在使用 MailMessage 类发送电子邮件

当我创建新的 MailMessage 对象时,它会使用 fromAddr 自动获取主机。例如,如果我的 fromaddress 是 chamara@pindoc.com.au 它假定主机为 pindoc.com.au 但我有不同的主机名称.所以主机名是错误的。我认为因为我收到以下错误。

{“邮箱不可用。服务器响应为:5.7.1 无法中继”} System.Exception {System.Net.Mail.SmtpFailedRecipientException}

我该如何解决这个问题?

0 投票
5 回答
375 浏览

asp.net - MailMessage 不会发送给超过 2 个收件人?

在 ASP.NET 中,我正在发送 MailMessage,但它不会通过。我正在使用的代码是

当我这样做时,我永远不会收到我的邮件。但是,如果我使用此代码:

每次发送都很好。有人知道这里发生了什么吗?所有 3 封电子邮件都是相同的(出于测试目的),并且在调试时已被验证为正确。我尝试为第三个插入不同的电子邮件地址,但仍然没有通过。我可能遗漏了一些明显的东西......

编辑:每个人都告诉我单独添加它们,如果每个人都同意,这可能是个好建议。我以前没有这样做的原因,我只是用三个单独的地址再次尝试,但没有一个被发送。如果应该可行的话,也许我还有另一个问题?

编辑:对于将来遇到同样问题的任何人,这就是我所做的。创建 MailMessage 时,我没有使用任何参数创建它,而是单独指定了 From 参数。我将 From 和所有 To 电子邮件都new MailAddress()包含在内,所有这些更改的组合似乎都有效。

0 投票
5 回答
1954 浏览

.net - 为什么 System.Net.Mail.MailMessage 实现 IDisposable

所以我一直在使用System.Net.Mail.MailMessage对象来发送电子邮件SmtpClient一段时间了。我注意到某个地方MailMessage实现了IDisposable,所以我总是在一个using块中使用它。

从元数据中,您可以看到有关执行的信息MailMessage

但我想知道,为什么MailMessage实施IDisposable?它似乎与网络相关的项目没有任何关系,因为SmtpClient处理所有这些。

可能是由于可能持有附加文件的文件句柄吗?还有什么我忘记了吗?

0 投票
3 回答
2690 浏览

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:

enter image description here

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:

enter image description here

0 投票
2 回答
1163 浏览

attachment - 使用 MailMessage 的 LinkedResources 嵌入文档

我正在使用以下代码将图像嵌入到我的 MailMessage 中。我想要做的是将文档(pdf 或 docx)嵌入到电子邮件中。

我已经尝试使用指向 href="cdi:myDoc.pdf" 的链接的超链接,但这不起作用。我也尝试过使用 MailMessage.Attachments.Add() 但在附件部分添加文档,而不是在消息中嵌入文档。

任何人如何在邮件中嵌入文档?我知道 Outlook 能够将附件放在邮件正文中,但我不知道如何通过 mailMessage 进行操作。

谢谢苏珊

0 投票
3 回答
1942 浏览

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 一起使用。我的配置代码如下...

0 投票
1 回答
200 浏览

.net - MailMessage 从测试 PC 发送 ok 但不是开发服务器

当我在本地测试时,我能够将 smtp 消息发送到第 3 方 smtp 服务器,但当我将此代码移植到我们的开发服务器时却不能。当我在那里尝试时,我真的不知道,但我认为它没有发出请求。我运行了 firebug、fiddler 并没有从我的代码中看到发送邮件请求的请求。

除了测试主机的 smtp 端点,我正在发送这个 smtp 请求以确保它对我们开放(确实如此),我一直试图弄清楚为什么相同的代码在我的机器上有效,但在我们的 Windows Server 2008 R2 上无效开发箱。

0 投票
7 回答
36519 浏览

c# - MailAddress 构造函数中的多个地址

我试图添加多个这样的地址。

但会抛出错误