Kif tibgħat email minn WebPart fil MOSS 2007

Hi devs,
Dan li ġej huwa l-biċċa tal-kodiċi li tibgħat email minn webpart.

bl-użu tas-Sistema;
bl-użu System.Collections.Generic;
użu System.ComponentModel;
użu System.Text;
użu System.Web;
użu System.Web.UI;
użu System.Web.UI.WebControls;
użu System.Collections.ObjectModel;
użu Microsoft.SharePoint.Utilities;
bl-użu Microsoft.SharePoint;
użu System.Data;
użu System.Collections;
namespace Sendmail
{
Sendmail pubblika ta 'klassi : Microsoft.SharePoint.WebPartPages.WebPart
{
privat kaxxa txtTo;
btnSendMail privat Button;
CreateChildControls protetti null ordni superjuri()
{
txtTo = ġdid kaxxa();
this.Controls.Add(txtTo);
btnSendMail = ġdid Button();
btnSendMail.Text = “Ibgħat Email”;
btnSendMail.Click = ġdid EventHandler(SendMail_Click);
this.Controls.Add(btnSendMail);
}
vojt SendMail_Click(mittent oġġett, EventArgs e)
{
SPSite _site = ġdid SPSite(HttpContext.Current.Request.Url.ToString());
SPWeb _web = _site.OpenWeb();
_web.AllowUnsafeUpdates = vera;
SPUtility.SendEmail(_web, falza, falza, txtTo.Text, “Email test”, “Messaġġ Korp Test”);
_web.Dispose();
_site.Dispose();
}
}
}

Oħloq il-WebPart u tirreġistraha bħala SafeControl

Leave a Reply

Tista 'tuża dawn it-tags HTML

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>