Monday 27 June 2011

C# email spoof

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;

namespace emailSpoof
{
    public class Class1
    {
        static public void Main()
        {
            String server = "<server>";

            MailAddress to = new MailAddress("john@hotmail.com");
            MailAddress from = new MailAddress("sarah@hotmail.com");
            MailMessage message = new MailMessage(from, to);

            message.Subject = "Hello!";
            message.Body = @"Hi, \n Hope you are well" ;

            SmtpClient client = new SmtpClient(server);

            try
            {
                client.Send(message);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
    }
}

No comments:

Post a Comment