Kuv tuaj los Devs,
Cov nram no yog cov daim cai xa Email ntawm webpart.
siv zog;
siv System.Collections.Generic;
siv System.ComponentModel;
siv System.Text;
siv System.Web;
siv System.Web.UI;
siv System.Web.UI.WebControls;
siv System.Collections.ObjectModel;
siv Microsoft.SharePoint.Utilities;
siv Microsoft.SharePoint;
siv System.Data;
siv System.Collections;
namespace SendMail
{
pej xeem hoob SendMail : Microsoft.SharePoint.WebPartPages.WebPart
{
lwm yam TextBox txtTo;
kheej khawm btnSendMail;
override tiv thaiv tsis muaj dabtsis CreateChildControls()
{
txtTo = TextBox tshiab();
qhov no.Controls.Add(txtTo);
btnSendMail = tshiab khawm();
btnSendMail.Text = “Xa Email”;
btnSendMail.Click = EventHandler tshiab(SendMail_Click);
qhov no.Controls.Add(btnSendMail);
}
SendMail_Click tsis muaj dabtsis(kwv sender, EventArgs e)
{
SPSite _site = SPSite tshiab(HttpContext.Current.Request.Url.ToString());
SPWeb _web = _site.OpenWeb();
_web.AllowUnsafeUpdates = tseeb;
SPUtility.SendEmail(_web, tsis tseeb, tsis tseeb, txtTo.Text, “Kuaj Email”, “Ntawv cev lus”);
_web.Muab pov tseg();
_site.Muab pov tseg();
}
}
}
Tsim tau lub WebPart thiab npe raws li SafeControl
sau ntawv cia