Results 1 to 2 of 2

Thread: Email Concept in .Net

  1. #1
    MorganCooper is offline Senior Member
    Join Date
    Dec 2009
    Posts
    233
    Rep Power
    3

    Default Email Concept in .Net

    I am learning .net and I am trying to write code for email sending in the asp.net but I am not able to write. Any help would be highly appreciated

  2. #2
    BellWard is offline Senior Member
    Join Date
    Dec 2009
    Posts
    236
    Rep Power
    3

    Default

    Try the following code which is resolve your problem.

    using System.Net;
    using System.Net.Mail;
    {
    //MailMessage mailMessage = new MailMessage(txtFrom.Text, txtTo.Text);
    //mailMessage.Subject = txtSubject.Text;
    //mailMessage.Body = txtBody.Text;

    MailMessage mailMessage = new MailMessage (From, To)
    mailMessage.Subject = "Resume";
    mailMessage.Body = "Hi";


    if (FileUpload1.HasFile)
    try
    {
    mailMessage.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName));
    }
    catch (Exception ex)
    {
    lblSendMsg.Text = "ERROR: " + ex.Message.ToString();
    }
    else
    {
    //lblAttError.Text = "You have not specified a file.";
    }
    try
    {
    SmtpClient Smtp = new SmtpClient();
    Smtp.Send(mailMessage);
    lblSendMsg.Text = "Message Send Successfully";
    }
    catch (Exception ex)
    {
    lblSendMsg.Text = "ERROR: " + ex.Message.ToString();
    }
    }

Similar Threads

  1. Tefuel Concept E 300, 5.1 multimedia set
    By ThomasBarnes in forum other peripherals
    Replies: 0
    Last Post: 08-25-2010, 05:27 PM
  2. HTC Evolve concept tablet PC
    By david harlow in forum Latest Hardware News
    Replies: 0
    Last Post: 12-19-2009, 10:24 PM
  3. Flash Actionscript - Concept Of Oops
    By Waverley in forum Programming
    Replies: 0
    Last Post: 10-27-2008, 07:40 AM
  4. Concept Draw 7 Professional
    By wenssal in forum Everything Else
    Replies: 0
    Last Post: 08-26-2008, 04:56 PM
  5. Windows 7: desperately in need of a new distribution concept
    By qaiwshik in forum Latest Hardware News
    Replies: 0
    Last Post: 07-31-2008, 05:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48