Browse Source

Added domain setting for hmailserver.

pull/29/head
Teknikode 6 years ago
parent
commit
2c4c32597c
  1. 12
      Teknik/Areas/Profile/Controllers/ProfileController.cs
  2. 3
      Teknik/Configuration/EmailConfig.cs

12
Teknik/Areas/Profile/Controllers/ProfileController.cs

@ -172,12 +172,12 @@ namespace Teknik.Areas.Profile.Controllers @@ -172,12 +172,12 @@ namespace Teknik.Areas.Profile.Controllers
// Connect to hmailserver COM
if (!Config.DevEnvironment)
{
string email = string.Format("{0}@{1}", model.Username, Config.Host);
string email = string.Format("{0}@{1}", model.Username, Config.EmailConfig.Domain);
var app = new hMailServer.Application();
app.Connect();
app.Authenticate(Config.EmailConfig.Username, Config.EmailConfig.Password);
var domain = app.Domains.ItemByName[Config.Host];
var domain = app.Domains.ItemByName[Config.EmailConfig.Domain];
try
{
var account = domain.Accounts.ItemByAddress[email];
@ -250,8 +250,8 @@ namespace Teknik.Areas.Profile.Controllers @@ -250,8 +250,8 @@ namespace Teknik.Areas.Profile.Controllers
var app = new hMailServer.Application();
app.Connect();
app.Authenticate(Config.EmailConfig.Username, Config.EmailConfig.Password);
var domain = app.Domains.ItemByName[Config.Host];
var account = domain.Accounts.ItemByAddress[string.Format("{0}@{1}",User.Identity.Name, Config.Host)];
var domain = app.Domains.ItemByName[Config.EmailConfig.Domain];
var account = domain.Accounts.ItemByAddress[string.Format("{0}@{1}",User.Identity.Name, Config.EmailConfig.Domain)];
account.Password = newPass;
account.Save();
@ -284,8 +284,8 @@ namespace Teknik.Areas.Profile.Controllers @@ -284,8 +284,8 @@ namespace Teknik.Areas.Profile.Controllers
var app = new hMailServer.Application();
app.Connect();
app.Authenticate(Config.EmailConfig.Username, Config.EmailConfig.Password);
var domain = app.Domains.ItemByName[Config.Host];
var account = domain.Accounts.ItemByAddress[string.Format("{0}@{1}", User.Identity.Name, Config.Host)];
var domain = app.Domains.ItemByName[Config.EmailConfig.Domain];
var account = domain.Accounts.ItemByAddress[string.Format("{0}@{1}", User.Identity.Name, Config.EmailConfig.Domain)];
account.Delete();
// Update uploads

3
Teknik/Configuration/EmailConfig.cs

@ -11,12 +11,15 @@ namespace Teknik.Configuration @@ -11,12 +11,15 @@ namespace Teknik.Configuration
public string Password { get; set; }
public string Domain { get; set; }
public int MaxSize { get; set; }
public EmailConfig()
{
Username = string.Empty;
Password = string.Empty;
Domain = string.Empty;
MaxSize = 1000;
}
}

Loading…
Cancel
Save