2
Answers

How to send email using C#?

lim

lim

19y
2k
1
Hi All,

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

Please let me know.

Thanks
Answers (2)
0
ernesto de la

ernesto de la

NA 2 0 19y

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
samrajcity

samrajcity

NA 22 0 19y

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