Kako poslati e-mail od WebPart u MAHOVINA 2007

Bok devs,
Sljedeći je dio koda za slanje e-pošte s web part.

primjenom sustava;
koristeći System.Collections.Generic;
pomoću System.ComponentModel;
pomoću System.Text;
pomoću System.Web;
pomoću System.Web.UI;
pomoću System.Web.UI.WebControls;
pomoću System.Collections.ObjectModel;
pomoću Microsoft.SharePoint.Utilities;
koristeći Microsoft.SharePoint;
pomoću System.Data;
pomoću System.Collections;
imenski prostor Sendmail
{
javne klase Sendmail : Microsoft.SharePoint.WebPartPages.WebPart
{
privatni školski txtTo;
privatni 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(objekt pošiljatelja, EventArgs e)
{
SPSite _site = new SPSite(HttpContext.Current.Request.Url.ToString());
SPWeb _web = _site.OpenWeb();
_web.AllowUnsafeUpdates = true;
SPUtility.SendEmail(_web, lažan, lažan, txtTo.Text, “Test Email”, “Text Body Message”);
_web.Dispose();
_site.Dispose();
}
}
}

Create the WebPart and register it as SafeControl

Dopust jedan Odgovor

Možete koristiti te tags HTML

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