emailsender

Discussion in '.NET' started by SoniaArun, Dec 18, 2012.

  1. SoniaArun

    SoniaArun

    Joined:
    Dec 18, 2012
    Messages:
    2
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Net.Mail;

    namespace emailsender
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
    try
    {

    string from = "arunkumarbt@turnerandmiller.us";
    // string from = "mail.turner@yahoo.com";
    //string from = "turnermiller7@gmail.com";
    string to = "jithesh@turnerandmiller.us";


    MailAddress mailfrom = new MailAddress(from);
    MailAddress mailto = new MailAddress(to);

    MailMessage msg = new MailMessage();
    msg.Subject = "test mail";
    msg.Body = "hai from software";
    msg.From = mailfrom;
    msg.To.Add(mailto);
    msg.Priority = MailPriority.High;

    SmtpClient mail = new SmtpClient("smtp.mail.turnerandmiller.us", 25);
    // SmtpClient mail = new SmtpClient("smtp.mail.gmail.com", 25);
    // SmtpClient mail = new SmtpClient("smtp.gmail.com", 587);
    // SmtpClient mail = new SmtpClient("smtp.mail.yahoo.com", 25);
    //mail.EnableSsl = true;
    mail.Credentials = new System.Net.NetworkCredential(from, "gorgeous");
    mail.Send(msg);

    MessageBox.Show("hai");
    }
    catch (Exception ex)
    {
    Console.WriteLine("InnerException is: {0}", ex.InnerException);
    MessageBox.Show(ex.ToString());

    }
    }
    }
    }
    SoniaArun, Dec 18, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page