![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Send Email in C#.NET Hi, I wish to be able to send an email in my C#.NET code in the following format: MailMessage objEmail = new MailMessage(); objEmail.To = "ez871@xxxxxx"; objEmail.From = "voyager666@xxxxxx"; objEmail.Subject = "Test Email"; objEmail.Body = "Price Mover test"; objEmail.Priority = MailPriority.High; //SmtpMail.SmtpServer = "localhost"; try{ SmtpMail.Send(objEmail); Response.Write("Your Email has been sent sucessfully - Thank You"); } catch (Exception exc){ Response.Write("Send failure: " + exc.ToString()); } However, I know that I must use a namespace related to email. What is that namespace? Also neither "SmtpMail" nor "MailMessage" is recognized by the compiler. Any advice on how to make this work? Thanks! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Send Email in C#.NET "Curious" <fir5tsight@xxxxxx> wrote in message news:2d11890c-e0cb-4c15-a42f-3a14ca166201@xxxxxx Quote: > Hi, > > I wish to be able to send an email in my C#.NET code in the following > format: > > MailMessage objEmail = new MailMessage(); > objEmail.To = "ez871@xxxxxx"; > objEmail.From = "voyager666@xxxxxx"; > objEmail.Subject = "Test Email"; > objEmail.Body = "Price Mover test"; > objEmail.Priority = MailPriority.High; > //SmtpMail.SmtpServer = "localhost"; > try{ > SmtpMail.Send(objEmail); > Response.Write("Your Email has been sent sucessfully - > Thank You"); > } > catch (Exception exc){ > Response.Write("Send failure: " + exc.ToString()); > } > > However, I know that I must use a namespace related to email. What is > that namespace? > Also neither "SmtpMail" nor "MailMessage" is recognized by the > compiler. Any advice on how to make this work? > > Thanks! http://msdn.microsoft.com/en-us/libr...mtpclient.aspx http://msdn.microsoft.com/en-us/libr...ilmessage.aspx http://msdn.microsoft.com/en-us/library/ms173026.aspx |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Send Email in C#.NET Hello Curious, I think System.Net is what you're looking for. -- Rory |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Send Email in C#.NET On Feb 26, 10:00*am, Rory Becker <rorybec...@xxxxxx> wrote: Quote: > Hello Curious, > > I think System.Net is what you're looking for. > > -- > Rory That's right - I used System.Net. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Send Email in C#.NET You can take a look here for some downloadable code: http://sholliday.spaces.live.com/Blo...842A!138.entry Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0) "Curious" <fir5tsight@xxxxxx> wrote in message news:2d11890c-e0cb-4c15-a42f-3a14ca166201@xxxxxx Quote: > Hi, > > I wish to be able to send an email in my C#.NET code in the following > format: > > MailMessage objEmail = new MailMessage(); > objEmail.To = "ez871@xxxxxx"; > objEmail.From = "voyager666@xxxxxx"; > objEmail.Subject = "Test Email"; > objEmail.Body = "Price Mover test"; > objEmail.Priority = MailPriority.High; > //SmtpMail.SmtpServer = "localhost"; > try{ > SmtpMail.Send(objEmail); > Response.Write("Your Email has been sent sucessfully - > Thank You"); > } > catch (Exception exc){ > Response.Write("Send failure: " + exc.ToString()); > } > > However, I know that I must use a namespace related to email. What is > that namespace? > Also neither "SmtpMail" nor "MailMessage" is recognized by the > compiler. Any advice on how to make this work? > > Thanks! |
My System Specs![]() |
![]() |
| Thread Tools | |
| |