Web.config file:
===========
<configuration>
<appSettings>
<add key="Email" value="chitharan89@gmail.com"/>
</appSettings>
<system.net>
<mailSettings>
<smtp >
<network host="127.0.0.1" port="25" userName ="chitharan89@gmail.com" password ="9715929121" />
</smtp>
</mailSettings>
</system.net>
<connectionStrings>
<add name="connection" connectionString="Data Source=SPTEST;database=db1;Integrated Security=True; "/>
</connectionStrings>
</configuration>
protected void imgBtnshare_Click(object sender, ImageClickEventArgs e)
{
try
{
string FromEmail = ConfigurationManager.AppSettings["Email"].ToString();
string ToEmail = "chitharan89@gmail.com";
MailMessage Message = new MailMessage(FromEmail, ToEmail);
Message.Subject = "To Share the Idea to Friends";
Message.Body = "The main Purpose sharing ideas to friend and get reply ";
Message.IsBodyHtml = true;
SmtpClient SMTP = new SmtpClient();
SMTP.Send(Message);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
No comments:
Post a Comment