mail attachment program in c#

  • Thread starter Thread starter vinodkus
  • Start date Start date
V

vinodkus

MailMessage MyMail = new MailMessage();
MyMail.To = txtTo.Text;
MyMail.From = txtFrom.Text;
MyMail.Subject = txtSubject.Text;
MyMail.Cc = txtCC.Text;
MyMail.Body = txtBody.Text;

******** MyMail.Attachments.Add(how can u put browse file
inside it);*****************

SmtpMail.Send(MyMail);

please give full code
i have done it in vb.net but i want to do it in c#
 
Hello (e-mail address removed),
MailMessage MyMail = new MailMessage();
MyMail.To = txtTo.Text;
MyMail.From = txtFrom.Text;
MyMail.Subject = txtSubject.Text;
MyMail.Cc = txtCC.Text;
MyMail.Body = txtBody.Text;
******** MyMail.Attachments.Add(how can u put browse file
inside it);*****************

which file?

See msdn http://msdn2.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx
SmtpMail.Send(MyMail);

please give full code
i have done it in vb.net but i want to do it in c#

Try online code translators http://www.carlosag.net/Tools/CodeTranslator/Default.aspx
http://www.developerfusion.com/utilities/convertcsharptovb.aspx

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
 
Back
Top