Ediatable Domain Expiration Tempalte added
This commit is contained in:
parent
1940fa9e52
commit
72a4c0d1ff
13 changed files with 461 additions and 47 deletions
|
@ -2,6 +2,7 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using WebsitePanel.Providers.DomainLookup;
|
||||
|
@ -116,12 +117,22 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
BackgroundTask topTask = TaskManager.TopTask;
|
||||
|
||||
var template = ObjectUtils.FillObjectFromDataReader<ScheduleTaskEmailTemplate>(DataProvider.GetScheduleTaskEmailTemplate(TaskId));
|
||||
UserSettings settings = UserController.GetUserSettings(user.UserId, UserSettings.DOMAIN_EXPIRATION_LETTER);
|
||||
|
||||
string from = settings["From"];
|
||||
|
||||
var bcc = settings["CC"];
|
||||
|
||||
string subject = settings["Subject"];
|
||||
string body = user.HtmlMail ? settings["HtmlBody"] : settings["TextBody"];
|
||||
bool isHtml = user.HtmlMail;
|
||||
|
||||
MailPriority priority = MailPriority.Normal;
|
||||
if (!String.IsNullOrEmpty(settings["Priority"]))
|
||||
priority = (MailPriority)Enum.Parse(typeof(MailPriority), settings["Priority"], true);
|
||||
|
||||
// input parameters
|
||||
string mailFrom = template.From;
|
||||
string mailTo = (string)topTask.GetParamValue("MAIL_TO");
|
||||
string mailSubject = template.Subject;
|
||||
|
||||
Hashtable items = new Hashtable();
|
||||
|
||||
|
@ -130,10 +141,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
ExpirationDate = x.ExpirationDate,
|
||||
Customer = string.Format("{0} {1}", domainUsers[x.PackageId].FirstName, domainUsers[x.PackageId].LastName) });
|
||||
|
||||
var mailBody = PackageController.EvaluateTemplate(template.Template, items);
|
||||
body = PackageController.EvaluateTemplate(body, items);
|
||||
|
||||
// send mail message
|
||||
MailHelper.SendMessage(mailFrom, mailTo, mailSubject, mailBody, true);
|
||||
MailHelper.SendMessage(from, mailTo, bcc, subject, body, priority, isHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,25 +40,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
foreach (var package in packages)
|
||||
{
|
||||
|
||||
PackageContext cntx = PackageController.GetPackageContext(package.PackageId);
|
||||
|
||||
if (cntx == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool dnsEnabled = cntx.GroupsArray.Any(x => x.GroupName == ResourceGroups.Dns);
|
||||
|
||||
if (!dnsEnabled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var domains = ServerController.GetDomains(package.PackageId);
|
||||
|
||||
domains = domains.Where(x => !x.IsSubDomain && !x.IsDomainPointer).ToList(); //Selecting top-level domains
|
||||
|
||||
domains = domains.Where(x => x.ZoneItemId > 0).ToList(); //Selecting only dns enabled domains
|
||||
|
||||
foreach (var domain in domains)
|
||||
{
|
||||
DomainChanges domainChanges = new DomainChanges();
|
||||
|
|
|
@ -2662,21 +2662,28 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static DomainInfo UpdateDomainRegistrationData(DomainInfo domain)
|
||||
{
|
||||
var whoisResult = WhoisClient.Query(domain.DomainName);
|
||||
|
||||
var createdDate = GetDomainInfoDate(whoisResult.Raw, _createdDatePatterns);
|
||||
var expiredDate = GetDomainInfoDate(whoisResult.Raw, _expiredDatePatterns);
|
||||
|
||||
if (createdDate != null)
|
||||
try
|
||||
{
|
||||
domain.CreationDate = createdDate;
|
||||
DataProvider.UpdateDomainCreationDate(domain.DomainId, createdDate.Value);
|
||||
var whoisResult = WhoisClient.Query(domain.DomainName);
|
||||
|
||||
var createdDate = GetDomainInfoDate(whoisResult.Raw, _createdDatePatterns);
|
||||
var expiredDate = GetDomainInfoDate(whoisResult.Raw, _expiredDatePatterns);
|
||||
|
||||
if (createdDate != null)
|
||||
{
|
||||
domain.CreationDate = createdDate;
|
||||
DataProvider.UpdateDomainCreationDate(domain.DomainId, createdDate.Value);
|
||||
}
|
||||
|
||||
if (expiredDate != null)
|
||||
{
|
||||
domain.ExpirationDate = expiredDate;
|
||||
DataProvider.UpdateDomainExpirationDate(domain.DomainId, expiredDate.Value);
|
||||
}
|
||||
}
|
||||
|
||||
if (expiredDate != null)
|
||||
{
|
||||
domain.ExpirationDate = expiredDate;
|
||||
DataProvider.UpdateDomainExpirationDate(domain.DomainId, expiredDate.Value);
|
||||
catch (Exception e)
|
||||
{
|
||||
//wrong domain
|
||||
}
|
||||
|
||||
return domain;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue