Here is the code:
Expand|Select|Wrap|Line Numbers
- using System;
- using System.Net.Mail;
- using System.Collections.Generic;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string to = "myEmail@hotmail.com";
- string from = "myEmail@hotmail.com";
- MailMessage message = new MailMessage(from, to);
- message.Subject = "New Car";
- message.Body = @"Hello Friend, I buy a new car today.";
- SmtpClient client = new SmtpClient("MyServerName");
- client.UseDefaultCredentials = true;
- client.Send(message);
- }
- }
- }
Can anyone help me.