mail attachment program in c#

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#
 
M

Michael Nemtsev

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top