tags:

views:

84

answers:

2

I'm new to ASP.NET with C#. Can anybody guide me on how to send an email through ASP.NET with C# using server (including configuring the server).

A: 

sorry but did you even try to google "c# send email"?

http://www.devx.com/tips/Tip/29291

Petoj
how to config the server to send the email from the asp.net with c# coding?
sri
+4  A: 
using System.Net.Mail;
...

MailMessage message = new MailMessage();
message.From = new MailAddress("[email protected]");

message.To.Add(new MailAddress("[email protected]"));
message.To.Add(new MailAddress("[email protected]"));
message.To.Add(new MailAddress("[email protected]"));

message.CC.Add(new MailAddress("[email protected]"));
message.Subject = "This is my subject";
message.Body = "This is the content";

SmtpClient client = new SmtpClient();
client.Send(message);

in the web.config

 <system.net>
<mailSettings>
  <smtp from="[email protected]">
    <network host="smtpserver1" port="25" userName="username" password="secret" defaultCredentials="true" />
  </smtp>
</mailSettings>

Thanks Scott

Paul Creasey
hai thanx for your reply... can you please explain what is host-"smtpserver1" username="username" password="secret".... where i going to get all these...????
sri
Google it, your can set up your own, use ur ISP's, use google/yahoo mails smtp servers.
Paul Creasey
okay thanx password and username is......?
sri
hai paul thanx the mail send successfully but i use localhost for sending the mail. could you tell me where the mail is store in my mail???????
sri