I want to create option like print and mail to friend in my site same as codeproject
-
can any body help me in this regard. How can i put these facility like codeproject did. Print and mail to friend options
Umesh
-
can any body help me in this regard. How can i put these facility like codeproject did. Print and mail to friend options
Umesh
cooolguymca wrote:
Print
Done by JS. window.print() should do. BTW, you can view the source of code project page and see how they implemented it.
cooolguymca wrote:
mail to friend
Read about
System.Net.MailMessage
andSystem.Net.SmtpClient
classes.Navaneeth How to use google | Ask smart questions
-
can any body help me in this regard. How can i put these facility like codeproject did. Print and mail to friend options
Umesh
For sending mail use code
using System;
using System.Data;
using System.Configuration;
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 class clsSendMail
{
private String SMTPServer = string.Empty;
public clsSendMail()
{
SMTPServer = "localhost";
}public String getSMTPServerName() { return SMTPServer; } public bool SendMail(String strToUser, String strFromUser, String strSubject, String strMessage) { bool blnResult = true; MailMessage myMail = new MailMessage(); SmtpClient objSMTP = new SmtpClient(SMTPServer); myMail.To.Add(strToUser); myMail.From = new MailAddress(strFromUser); myMail.Subject = strSubject; myMail.Body = strMessage; myMail.IsBodyHtml = true; try { //obClient.Send(myMail); objSMTP.Send(myMail); blnResult = true; } catch { blnResult = false; } return blnResult; }
}