Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Visual Studio 2015 - Cannot use Mail!?

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.
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".
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.

🤝
VS should offer to correct using directives missed and System.dll should be referenced automatically. More info please.
(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??
Have a cool signature? hit me up and I might use it.
(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]
(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


Possibly Related Threads...
Thread / Author Replies Views Last Post
by brokenheartsJun 30, 2025 01:05 AM 29 1,076 Jun 30, 2025 01:05 AM
Last Post: HOMODIN
[Tutorial] by WhiteTVFeb 17, 2025 08:25 AM 0 112 Feb 17, 2025 08:25 AM
Last Post: WhiteTV
by HackersDec 11, 2024 05:11 PM 21 524 Dec 11, 2024 05:11 PM
Last Post: padrino