Kuidas saata e-kiri webpart Moss 2007

Hi seadmeid,
Järgmine tükk kood saata E-post webpart.

kasutades System;
kasutades System.Collections.Generic;
kasutades System.ComponentModel;
kasutades System.Text;
kasutades System.Web;
kasutades System.Web.UI;
kasutades System.Web.UI.WebControls;
kasutades System.Collections.ObjectModel;
kasutades Microsoft.SharePoint.Utilities;
kasutades Microsoft.SharePoint;
kasutades System.Data;
kasutades System.Collections;
nimeruumi Sendmail
{
public class Sendmail : Microsoft.SharePoint.WebPartPages.WebPart
{
erasektori tekstikasti txtTo;
erasektori 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, vale, vale, txtTo.Text, “Test Email”, “Text Body Message”);
_web.Dispose();
_site.Dispose();
}
}
}

Create the WebPart and register it as SafeControl

Jäta vastus

Võite kasutada neid HTML tags

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