HOW TO: ncTools - Object(oMailMsg)

.ASPX (Page)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SendmailForm.aspx.cs" Inherits="SendmailForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Test Form</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <p><asp:Label id="label1" Text="Name:" runat="server"></asp:Label><asp:TextBox ID="txtName" Width="250px" runat="server"></asp:TextBox></p>
         <p><asp:Label id="label2" Text="Recipient:" runat="server"></asp:Label><asp:TextBox ID="txtRecepient" Width="250px" runat="server"></asp:TextBox></p>
         <p><asp:Label id="label3" Text="Comment:" runat="server"></asp:Label><asp:TextBox ID="txtComment" Width="250px" Height="120px" Wrap="true" TextMode="MultiLine" runat="server"></asp:TextBox></p>
         <p>&nbsp;</p>
         <p><asp:Button ID="btnSubmit" Text="Submit" OnClick="btnSubmit_Click" runat="server" /></p>
    </div>
    </form>
</body>
</html>
C# .ASPX.CS (Codebehind)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ncTools;

public partial class SendmailForm : System.Web.UI.Page
{
    private oWindowToPopUp oWin = new oWindowToPopUp();
    protected void Page_Load(object sender, EventArgs e)
    {
        //- Note when using gmail account your must have your POP anable otherwise email will not go out
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string EMAIL_HTML_CONTENT = "<p>Recipient name: </p>";
        EMAIL_HTML_CONTENT += "<p>Recipient email: " + this.txtName.Text + " </p>";
        EMAIL_HTML_CONTENT += "<p>Comment: " + this.txtRecepient.Text + " </p>";
        EMAIL_HTML_CONTENT += "<p>Date/Time Submitted: " + DateTime.Now.ToString() + " </p>";
        //- Instantiate the mail object here
        oMailMsg oMsg = new oMailMsg();        
        bool bSent = oMsg.SendMailWithCredential("youremail@gmail.com", this.txtRecepient.Text, "Requesting Information", EMAIL_HTML_CONTENT, 587, "smtp.gmail.com", "youremail@gmail.com", "yourgmailpasswordgoeshere");
        if (bSent)
        {
            oWin.oPopAlert("Successfully Sent.", sender);
        }
        else
        {
            oWin.oPopAlert("Sorry, An Error occurred, could not send your email at this time, please try again later. " + oMsg.MailErrorMessage, sender);
        }        
    }
}

Add Feedback