Thursday, April 28, 2011

Send mail through server object model


public void sendEmail(string mailid)
        {
            try
            {
                SPWeb web = SPContext.Current.Web;
                bool appendHtmlTag = false;
                bool htmlEncode = false;
                string toAddress = mailid;
                string subject = "Comments";
                string message = txtComment.Text;
                bool result = SPUtility.SendEmail(web, appendHtmlTag, htmlEncode, toAddress, subject, message);

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }

No comments:

Post a Comment

How to launch a document by clicking a link to the file?

Word: <a href='ms-word:ofe|u|path/to/web/word/document.docx'>Link to document</a> Excel: <a href='ms-excel:o...