Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Send Email in C#.NET

Reply
 
Old 02-26-2009   #1 (permalink)
Curious


 
 

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 SpecsSystem Spec
Old 02-26-2009   #2 (permalink)
PvdG42


 
 

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!
Here are some places in MSDN to start looking:

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 SpecsSystem Spec
Old 02-26-2009   #3 (permalink)
Rory Becker


 
 

Re: Send Email in C#.NET

Hello Curious,

I think System.Net is what you're looking for.

--
Rory


My System SpecsSystem Spec
Old 02-26-2009   #4 (permalink)
Curious


 
 

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
Hi Rory,

That's right - I used System.Net.
My System SpecsSystem Spec
Old 02-27-2009   #5 (permalink)
sloan


 
 

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 SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
can't send page by email or send link by email from IE8. windows mail default client Vista mail
I can send email in windows live, but can't send most of my emaiol :( Vista mail
can you tell me why i cant send mail and why my new microsoft cant send what i typed to my email Vista mail
can't send email after scanning or send link to from web info Vista mail
Windows mail can't send email but in XP/2000 pro. send working OK Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46