EDIT: This question is pointless, except as an exercise in red herrings. The issue turned out to be a combination of my idiocy (NO ONE was being emailed as the host was not being specified and was incorrect in web.config) and the users telling me that they sometimes got the emails and sometimes didn't, when in reality they were NEVER getting the emails.
So, instead of taking proper steps to reproduce the problem in a controlled setting, I relied on user information and the "it works on my machine" mentality. Good reminder to myself and anyone else out there who is sometimes an idiot.
我只是打了一些我认为不一致的东西,想看看我是不是做错了什么,我是不是白痴,或者...
MailMessage msg = new MailMessage();
msg.To.Add("person1@domain.com");
msg.To.Add("person2@domain.com");
msg.To.Add("person3@domain.com");
msg.To.Add("person4@domain.com");
真的只发送这封邮箱给1个人,最后一个人.
要添加倍数,我必须这样做:
msg.To.Add("person1@domain.com,person2@domain.com,person3@domain.com,person4@domain.com");
我还是不明白.我以为我要将多个人添加到To
个地址集合中,但我所做的是替换它.
我想我刚刚意识到了我的错误——要向集合中添加一个项目,请使用
如果你只使用string
,它将替换列表中的所有内容.
啊.我认为这是一个相当大的trap !既然我回答了自己的问题,但我认为这在stackoverflow存档中是有价值的,我还是会问.也许有人甚至想到了你可能会落入的其他trap .