1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to send mail in a sequece in asp.net

Discussion in 'C#' started by alamlinks, Sep 28, 2012.

  1. #1
    The answer is as below:

    string strTo = txtTo.Text;
    for (int i = 0; i < strTo.Split(',').Length;i++ )
    {
    string strMailId = strTo.Split(',');
    try
    {
    MailMessage msg = new MailMessage();
    msg.From = txtFrom;
    msg.To=txtTo;
    msg.Subject = txtSubject.Text;
    msg.IsBodyHtml = true;
    msg.Body = txtMail.Text;
    msg.Priority = MailPriority.High;

    System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.gmail.com", 25);
    client.UseDefaultCredentials = false;
    client.Credentials = new System.Net.NetworkCredential("xxx@gmail.com", "xxx"); //Email and Password

    client.EnableSsl = true;

    client.Send(
    msg );

    ScriptManager.RegisterStartupScript(btnSend, typeof(Page), "Confirm", "alert('Your enquiry sent successfully!');formReset();", true);
    }
    catch (Exception Ex)
    {
    ScriptManager.RegisterStartupScript(btnSend, typeof(Page), "Error:", "alert('Oops! Some error occoured.')", true);
    }
    }
    For more knowledge go through http://failuredeveloper.blogspot.com/


    Thanks & Regfards
     
    alamlinks, Sep 28, 2012 IP