asp.net的邮件信息无法做replytolist.add

问题描述:

我有一个页面,我发送电子邮件爆炸。该页面工作并发送电子邮件。然而,当IA尝试添加电子邮件地址,包括作为的replyTo收件人我收到此错误:asp.net的邮件信息无法做replytolist.add

'System.Net.Mail.MailMessage' does not contain a definition for 'ReplyToList' and no extension method 'ReplyToList' accepting a first argument of type 'System.Net.Mail.MailMessage' could be found (are you missing a using directive or an assembly reference?) 

我使用此代码:

mailMessage.ReplyToList.Add(“[email protected]” );

这适用于 mailMessage.CC.Add(“[email protected]”); mailMessage.bcc.Add(“[email protected]”); 等

谢谢

+0

你的目标是什么框架版本? – SLaks

+0

.net framework 3.5 –

你当你的编译器是想告诉你,没有这样的属性存在。

如果你看看the documentation,你会发现它是在.Net 4.0中添加的。

早期版本改为使用ReplyTo property

+0

然后我得到这个错误,而不是:'System.Net.Mail.MailAddress'不包含'添加'的定义和没有扩展方法'添加'接受类型'System.Net.Mail的第一个参数.MailAddress'可以找到(你是否缺少使用指令或程序集引用?) –

+0

@johnsmith:阅读文档。这不是一个列表。 – SLaks

+0

请原谅我的无知 - 我将如何设置它?我不能这样做mailmessage.replyto =“” –