public class SampleTimerJob : SPJobDefinition
{
public SampleTimerJob(string jobName, SPWebApplication webApplication, string url, string email)
: base(jobName, webApplication, null, SPJobLockType.ContentDatabase)
{
ContainerSite = url;
Email = email;
this.Title = "sample timer";
}
public string ContainerSite
{
get { return Properties["site"].ToString(); }
set { Properties["site"] = value; }
}
public string Email
{
get { return Properties["email"].ToString(); }
set { Properties["email"] = value; }
}
public override void Execute(Guid targetInstanceId)
{
SPSite site = new SPSite(ContainerSite);
using (SPWeb web = site.OpenWeb())
{
SPUtility.SendEmail(web, false, false, Email,
"title",
"content");
}
}
}
No comments:
Post a Comment