C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Send Mail


Posted Date: 07 Oct 2008      Total Responses: 1

Posted By: chandra       Member Level: Bronze     Points: 1


hi,
i want to send mail from my website to any ohter websites accounts(like gmail,yahoo,rediffmail).

i am developing application for doctors.into my application the basic idea is
if visitor/doctors comes for registration into my site after his registration
i want to send the userid and password to his/her other websites accounts,like the other webports do as in dotnetspider also.

so how can i do this. i have tried many codes for this.but not got the result.
can anyone help me regarding this problem.
thank you




Responses

Author: Meetu Choudhary    07 Oct 2008Member Level: GoldRating:     Points: 15
The following Sample Code is the code which can be used to send mails through ASP.Net C#.... its a working code for me.....


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.
WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;

public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//Calling the function SendMail
Response.Write( SendMail("meetuchoudhary@gmail.com","meetudmeet@gmail.com","meetudmeet@yahoo.com","Test Mail","Test Mail Body"));
}

public string SendMail(string toList, string from, string ccList, string subject, string body)
{
MailMessage message = new MailMessage();
SmtpClient smtpClient = new SmtpClient();
string msg = string.Empty;
try
{
MailAddress fromAddress = new MailAddress(from);
message.From = fromAddress;
message.To.Add(toList);
if (ccList != null && ccList != string.Empty)
message.CC.Add(ccList);
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
smtpClient.Host = "mail.server.com";
smtpClient.Port = 25;
smtpClient.UseDefaultCredentials = true;
smtpClient.Credentials = new System.Net.NetworkCredential("info@server.com", "password");

smtpClient.Send(message);
msg = "Successful";
}
catch (Exception ex)
{
msg = ex.Message;
}
return msg;
}

}



please visit


http://www.dotnetspider.com/resources/21608-Sending-Email-Through-ASP-NET-using-C.aspx


--
Thanks and Regards
Meetu Choudhary



Post Reply
You must Sign In to post a response.
Next : back button
Previous : Encryption in .NET
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use