Hi Devs,
zifuatazo ni kipande cha utaratibu wa kutuma Email kutoka webpart.
kutumia Mfumo wa;
kutumia System.Collections.Generic;
kutumia System.ComponentModel;
kutumia System.Text;
kutumia System.Web;
kutumia System.Web.UI;
kutumia System.Web.UI.WebControls;
kutumia System.Collections.ObjectModel;
kutumia Microsoft.SharePoint.Utilities;
kutumia Microsoft.SharePoint;
kutumia System.Data;
kutumia System.Collections;
namespace SendMail
{
umma darasa SendMail : Microsoft.SharePoint.WebPartPages.WebPart
{
binafsi kisanduku cha maandishi txtTo;
binafsi Button btnSendMail;
protected override void CreateChildControls()
{
txtTo = new TextBox();
this.Controls.Add(txtTo);
btnSendMail = new Button();
btnSendMail.Text = “Send Email”;
btnSendMail.Click = new EventHandler(SendMail_Click);
this.Controls.Add(btnSendMail);
}
void SendMail_Click(object sender, EventArgs e)
{
SPSite _site = new SPSite(HttpContext.Current.Request.Url.ToString());
SPWeb _web = _site.OpenWeb();
_web.AllowUnsafeUpdates = true;
SPUtility.SendEmail(_web, uongo, uongo, txtTo.Text, “Test Email”, “Text Body Message”);
_web.Dispose();
_site.Dispose();
}
}
}
Create the WebPart and register it as SafeControl
BBC