Hi,
I want to send no emails with attachments.But i dont know anything about sending emails.Im using windows 7 visual studio 2008.
I was looking for help on internet.
According to them I installed IIS.I think it is IIS 7.
How to check the version of IIS?
Also smtp is not Shown in IIS.It was mentioned IIS 7 does not provide smtp.
Do i need to create any profile or somthing?
Im new to this. PLZ help me with a link or help me to do this.

You don't need IIS to send mail from .NET

A good starting point is MSDN documentation of System.Net.Mail namespace. Here's one example from MSDN. Not very good one, but do a bit googling: how to send mail with c sharp and you'll find examples and tutorials about this subject.

You do, however, need an SMTP server. If you have Gmail address (or create one) you can use Google's servers. There are instructions somewhere. But check first if your ISP provides SMTP server. One thing to remember is, if you create some spamming system, your account will be suspended.

HTH

Thank you.
PLZ help me Plz
I get a smtpException in client.send(message) line.

SmtpClient client = new SmtpClient("pop.mail.yahoo.com");
          
            MailAddress from = new MailAddress("emailAddress","username" + (char)0xD8 + "password",System.Text.Encoding.UTF8);
            
            MailAddress to = new MailAddress("buddhibj@yahoo.com");
       
            MailMessage message = new MailMessage(from, to);
            message.Body = "This is a test e-mail message sent by an application. ";
           
            message.BodyEncoding = System.Text.Encoding.UTF8;
            message.Subject = "test message 1";
            message.SubjectEncoding = System.Text.Encoding.UTF8;
         
            client.Send(message);

Let's fix the code a bit. POP or POP3 is incoming mail, outgoing mail protocol is SMTP. You have to also set DeliveryMethod and Port-number properties. And the most important thing is credentials i.e. username and password to your SMTP server (i.e. Yahoo account in this case).

Here's the code:

// SmtpClient client = new SmtpClient("pop.mail.yahoo.com"); POP3 is for incoming mail!!!

// Outgoing Mail (SMTP) Server: smtp.mail.yahoo.com (Use SSL, port: 465, use authentication)
// I have account in UK, but the line above should be correct for you
SmtpClient client = new SmtpClient("smtp.mail.yahoo.co.uk"); 

// Authenticate yourself, YahooID is your Yahoo email address w/o "@yahoo.com"
client.Credentials = new System.Net.NetworkCredential("YahooID", "password to your Yahoo account");

// For some reason SSL didn't work
//client.EnableSsl = true; // Set SSL on -> port = 465
client.EnableSsl = false; // Set SSL off -> port = 25 or 587
client.Port = 587; // Set correct port
client.DeliveryMethod = SmtpDeliveryMethod.Network; // ADD THIS LINE !!!

MailAddress from = new MailAddress("myaddress@yahoo.co.uk");

MailAddress to = new MailAddress("myaddress@acme.com");

MailMessage message = new MailMessage(from, to);
message.Body = "This is a test e-mail message sent by an application. ";

message.BodyEncoding = System.Text.Encoding.UTF8;
message.Subject = "test message 1";
message.SubjectEncoding = System.Text.Encoding.UTF8;

// Always catch Send(msg) errors
try
{
    client.Send(message);
}
catch (SmtpException ex)
{
    MessageBox.Show(ex.Message);
}

This worked with my Yahoo account with correct ID, password and email addresses. SSL didn't work but it should. I use yahoo.co.uk domain so remember to change that to yahoo.com. In Yahoo's settings you need to set: Settings -> POP & Forwarding -> Allow your Yahoo! Mail to be POPed. See also: Yahoo POP3 and SMTP Settings.

This same code should work with Gmail etc. when you change correct port-number, SMTP server name etc. If the code doesn't work, you have most likely wrong port-number, SSL-setting or misspelled names :D

HTH

commented: Good snip +3

One thing about choosing the method of sending email is what will be sending the mail. Its important that if this is a mail application, and you intend to allow the end user to modify the serer settings to match their own info, or you intend to use this for personal use only. Then its fine to use this method.

But if you are creating a production application and you expect to distribute it. Yahoos not going to be happy with you sending 100,000 smtp relays on your free yahoo account, plus the messages will always be traceable back to your account, and you will be liable for that.

If you are, for example, adding a call home system in an application, to report errors, or maybe a feedback mailer. Then a good system would be to have the desktop app post some vars to a script on a webserver somewhere and have the server either handle the smtp server setup so you can change it easily and it will reflect in all the applications that use it. Or have the webserver its self handle the SMTP. all asp.net web servers have smtp built in. They always suggest you don't use it, and VS will give you warnings that its depreciated. But it works, if you just use System.Web.Mail.SmtpMail.Send(message) on a asp.net site. It will just send it. No questions asked. Then you can set a response and have your desktop app check for that just to make sure it sent. The best part about this, is as long as you don't update your webserver its guaranteed to to work, and in the event that you have to do an update and they finally remove this (which I doubt they will) then you can just edit your script to something that does use an smtp server setup like posted above.

These are just some points i wanted to make. Teme64 had it right. Given the question you asked, that is certainly a complete answer.

Let's fix the code a bit. POP or POP3 is incoming mail, outgoing mail protocol is SMTP. You have to also set DeliveryMethod and Port-number properties. And the most important thing is credentials i.e. username and password to your SMTP server (i.e. Yahoo account in this case).

Here's the code:

// SmtpClient client = new SmtpClient("pop.mail.yahoo.com"); POP3 is for incoming mail!!!

// Outgoing Mail (SMTP) Server: smtp.mail.yahoo.com (Use SSL, port: 465, use authentication)
// I have account in UK, but the line above should be correct for you
SmtpClient client = new SmtpClient("smtp.mail.yahoo.co.uk"); 

// Authenticate yourself, YahooID is your Yahoo email address w/o "@yahoo.com"
client.Credentials = new System.Net.NetworkCredential("YahooID", "password to your Yahoo account");

// For some reason SSL didn't work
//client.EnableSsl = true; // Set SSL on -> port = 465
client.EnableSsl = false; // Set SSL off -> port = 25 or 587
client.Port = 587; // Set correct port
client.DeliveryMethod = SmtpDeliveryMethod.Network; // ADD THIS LINE !!!

MailAddress from = new MailAddress("myaddress@yahoo.co.uk");

MailAddress to = new MailAddress("myaddress@acme.com");

MailMessage message = new MailMessage(from, to);
message.Body = "This is a test e-mail message sent by an application. ";

message.BodyEncoding = System.Text.Encoding.UTF8;
message.Subject = "test message 1";
message.SubjectEncoding = System.Text.Encoding.UTF8;

// Always catch Send(msg) errors
try
{
    client.Send(message);
}
catch (SmtpException ex)
{
    MessageBox.Show(ex.Message);
}

This worked with my Yahoo account with correct ID, password and email addresses. SSL didn't work but it should. I use yahoo.co.uk domain so remember to change that to yahoo.com. In Yahoo's settings you need to set: Settings -> POP & Forwarding -> Allow your Yahoo! Mail to be POPed. See also: Yahoo POP3 and SMTP Settings.

This same code should work with Gmail etc. when you change correct port-number, SMTP server name etc. If the code doesn't work, you have most likely wrong port-number, SSL-setting or misspelled names :D

HTH

Thank you ver much.
It works.

Let's fix the code a bit. POP or POP3 is incoming mail, outgoing mail protocol is SMTP. You have to also set DeliveryMethod and Port-number properties. And the most important thing is credentials i.e. username and password to your SMTP server (i.e. Yahoo account in this case).

Here's the code:

// SmtpClient client = new SmtpClient("pop.mail.yahoo.com"); POP3 is for incoming mail!!!

// Outgoing Mail (SMTP) Server: smtp.mail.yahoo.com (Use SSL, port: 465, use authentication)
// I have account in UK, but the line above should be correct for you
SmtpClient client = new SmtpClient("smtp.mail.yahoo.co.uk"); 

// Authenticate yourself, YahooID is your Yahoo email address w/o "@yahoo.com"
client.Credentials = new System.Net.NetworkCredential("YahooID", "password to your Yahoo account");

// For some reason SSL didn't work
//client.EnableSsl = true; // Set SSL on -> port = 465
client.EnableSsl = false; // Set SSL off -> port = 25 or 587
client.Port = 587; // Set correct port
client.DeliveryMethod = SmtpDeliveryMethod.Network; // ADD THIS LINE !!!

MailAddress from = new MailAddress("myaddress@yahoo.co.uk");

MailAddress to = new MailAddress("myaddress@acme.com");

MailMessage message = new MailMessage(from, to);
message.Body = "This is a test e-mail message sent by an application. ";

message.BodyEncoding = System.Text.Encoding.UTF8;
message.Subject = "test message 1";
message.SubjectEncoding = System.Text.Encoding.UTF8;

// Always catch Send(msg) errors
try
{
    client.Send(message);
}
catch (SmtpException ex)
{
    MessageBox.Show(ex.Message);
}

This worked with my Yahoo account with correct ID, password and email addresses. SSL didn't work but it should. I use yahoo.co.uk domain so remember to change that to yahoo.com. In Yahoo's settings you need to set: Settings -> POP & Forwarding -> Allow your Yahoo! Mail to be POPed. See also: Yahoo POP3 and SMTP Settings.

This same code should work with Gmail etc. when you change correct port-number, SMTP server name etc. If the code doesn't work, you have most likely wrong port-number, SSL-setting or misspelled names :D

HTH

Thank you very much for concerning.Yes i solved
Thnbks once again

One thing about choosing the method of sending email is what will be sending the mail. Its important that if this is a mail application, and you intend to allow the end user to modify the serer settings to match their own info, or you intend to use this for personal use only. Then its fine to use this method.

But if you are creating a production application and you expect to distribute it. Yahoos not going to be happy with you sending 100,000 smtp relays on your free yahoo account, plus the messages will always be traceable back to your account, and you will be liable for that.

If you are, for example, adding a call home system in an application, to report errors, or maybe a feedback mailer. Then a good system would be to have the desktop app post some vars to a script on a webserver somewhere and have the server either handle the smtp server setup so you can change it easily and it will reflect in all the applications that use it. Or have the webserver its self handle the SMTP. all asp.net web servers have smtp built in. They always suggest you don't use it, and VS will give you warnings that its depreciated. But it works, if you just use System.Web.Mail.SmtpMail.Send(message) on a asp.net site. It will just send it. No questions asked. Then you can set a response and have your desktop app check for that just to make sure it sent. The best part about this, is as long as you don't update your webserver its guaranteed to to work, and in the event that you have to do an update and they finally remove this (which I doubt they will) then you can just edit your script to something that does use an smtp server setup like posted above.

These are just some points i wanted to make. Teme64 had it right. Given the question you asked, that is certainly a complete answer.

Thank you very much.
I could solve it with all of ur helps