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).
how to config the server to send the email from the asp.net with c# coding?
sri
2010-03-29 05:56:53
+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
2010-03-28 16:07:48
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
2010-03-29 04:31:53
Google it, your can set up your own, use ur ISP's, use google/yahoo mails smtp servers.
Paul Creasey
2010-03-29 06:46:24
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
2010-03-29 15:50:07