Paano Magpadala ng isang email mula sa WebPart sa Moss 2007

Hi Devs,
Ang mga sumusunod ay mga piraso ng code na magpadala ng E-mail mula sa webpart.

paggamit ng System;
gamit System.Collections.Generic;
gamit System.ComponentModel;
gamit System.Text;
gamit System.Web;
gamit System.Web.UI;
gamit System.Web.UI.WebControls;
gamit System.Collections.ObjectModel;
gamit Microsoft.SharePoint.Utilities;
gamit Microsoft.SharePoint;
gamit System.Data;
gamit System.Collections;
namespace SendMail
{
pampublikong klase SendMail : Microsoft.SharePoint.WebPartPages.WebPart
{
pribadong textbox txtTo;
pribadong btnSendMail Pindutan;
protected override void CreateChildControls()
{
txtTo = new TextBox();
this.Controls.Add(txtTo);
btnSendMail = new Button();
btnSendMail.Text = “Magpadala ng Email”;
btnSendMail.Click = bagong EventHandler(SendMail_Click);
this.Controls.Add(btnSendMail);
}
walang bisa SendMail_Click(Ang nagpadala na bagay, EventArgs e)
{
SPSite _site = bagong SPSite(HttpContext.Current.Request.Url.ToString());
_web SPWeb = _site.OpenWeb();
_web.AllowUnsafeUpdates = true;
SPUtility.SendEmail(_web, hindi totoo, hindi totoo, txtTo.Text, “Pagsubok ng Email”, “Text Katawan ng Mensahe”);
_web.Dispose();
_site.Dispose();
}
}
}

Lumikha ng WebPart at iparehistro ito bilang SafeControl

Mag-iwan ng isang Sumagot

Maaari mong gamitin ang mga tag na HTML

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