Skip to content

How to send email using C#?

lim

Asked Jan 12, 2006, 1:11 AM EST2 answers
Share
LinkedInX
Hi All,

Does anyone have an example of how to send email using C#?

Please let me know.

Thanks

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    hi

    System.Web.Mail.MailMessage ObjMailMessage=new System.Web.Mail.MailMessage()
    ObjMailMessage.From = FromEmailid
    ObjMailMessage.To = toaddress
    objMailMessage.Subject = Subject
    ObjMailMessage.Body = bodytext

    // Create the Object of System.Web.Mail.SmtpMail.SmtpServer class.
    System.Web.Mail.SmtpMail ObjSmtpMail = new System.Web.Mail.SmtpMail
    //Assign the mail server IP address to the SmtpServer property.
    ObjSmtpMail.SmtpServer = SMTPMailServerIP  
    //Object of the Mail message class is passed in the send function.
      ObjSmtpMail.Send(ObjMailMessage)


    tks

    0
  • 0
    I use that code and can´t send anything because I don´t know what library have to use , this is the error that raise the program "The type or namespace "mail" does not exist in the class or mamespace "System Web" (are you missing an assembly reference?)"

    what I have to do?
    0