You are missing a lot of stuff.
First of all, I suggest you to type these at the top of your code:
Code:
using System.Net;
using System.Net.Mail;
Then you could just create instances more easily (without this whole string)
Alright,
In order to get it working, you'll have to supply your network credential: you'll be doing it this way:
Code:
smtp.Credentials = new NetworkCredential("USERNAME", "PASSWORD");
Now, if you want to make it work you must run an SMTP server on your localhost or use existent one (e.g: smtp.gmail.com)
Anyways, here's a little code I wrote:
Code:
SmtpClient client = new SmtpClient("smtp.gmail.com", 25);
client.Credentials = new NetworkCredential("USERNAME", "PASSWORD");
MailMessage mail = new MailMessage(new MailAddress("[email protected]"), new MailAddress("[email protected]"));
mail.Subject = "Hello world!";
mail.Body = "Hello world!";
client.EnableSsl = true; // gmail uses SSL
client.Send(mail);