Hack Forums
[C#] Visual Studio 2015 - Cannot use Mail!? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Visual Studio 2015 - Cannot use Mail!? (/showthread.php?tid=5327878)



Visual Studio 2015 - Cannot use Mail!? - Lipton's Ice Tea™ - Jul 4, 2016

Can't use mail at all within C# Visual Studio 2015 using .Net 4.6.1 (or any other framework)

Trying to send mail but get all of the following errors when trying to use the type or namespace; "smtpClient" or "MailMessage"

Annoyingly I've looked through references and can't find System.Net.Mail.

It's really pissing me off, any help would be appreciated.


* - Grand Reserve - Jul 4, 2016

The only fixes I can think of are:

1.) Remove the System.dll reference & re-add it.
2.) Create a new project and see if it works
3.) Make sure your target framework isn't "Client Profile".


* - GuRuHaX - Jul 6, 2016

In addition to what is said above , System.Net.Mail classes are contained in the "System.dll" file. Make sure you have a reference to System listed under References in your project or that you are using namespace 'System' on top of your class / form.

🤝


* - Odus - Jul 6, 2016

VS should offer to correct using directives missed and System.dll should be referenced automatically. More info please.


* - severos - Jul 7, 2016

(Jul 6, 2016 01:18 PM)Odus Wrote:  VS should offer to correct using directives missed and System.dll should be referenced automatically. More info please.

Did VS offer that out of the box? don't remember this feature before installing ReSharper plugin.
I'm not familiar with sending email using c# but maybe there's a nuget package you need to install first??


* - Vuln - Jul 7, 2016

(Jul 7, 2016 06:09 AM)severos Wrote:  Did VS offer that out of the box? don't remember this feature before installing ReSharper plugin.
I'm not familiar with sending email using c# but maybe there's a nuget package you need to install first??

It's a default VS feature. Although perhaps not in the (obsolete) Express versions.

[img]http://hfimage.net/images/a4llyx7exr1fvigyfsyk.png[/img]


* - Odus - Jul 7, 2016

(Jul 7, 2016 06:09 AM)severos Wrote:  Did VS offer that out of the box? don't remember this feature before installing ReSharper plugin.
I'm not familiar with sending email using c# but maybe there's a nuget package you need to install first??

Yup. A little lightbulb will appear if VS thinks it can fix an error or has a suggestion to make. https://msdn.microsoft.com/en-us/library/dn872466.aspx