SmtpClient.Send() complains of incorrect no of overloads when passing in MailMessage object

Posted by dotnetdev on Stack Overflow See other posts from Stack Overflow or by dotnetdev
Published on 2010-03-14T00:59:33Z Indexed on 2010/03/14 1:05 UTC
Read the original article Hit count: 424

Filed under:

Hi,

I have this code written in .NET 4.0 using VS2010 Ultimate Beta 2:

smtpClient.Send(mailMsg);

smtpClient is a reference to SmtpClient (I have the relevant references added), and likewise for mailMsg (is MailMessage) - there are no errors stating anything like check for missing assemblies.

However, I keep getting an error saying that I have the incorrect no of overloads, when SmtpClient takes either a MailMessage object or the To address, From address, Subject, etc.

Why doesn't this code work? Totally confused.

Thanks

© Stack Overflow or respective owner

Related posts about c#