Browse Source

Added domain setting for hmailserver.

tags/2.0.3
Teknikode 4 years ago
parent
commit
2c4c32597c

+ 6
- 6
Teknik/Areas/Profile/Controllers/ProfileController.cs View File

@@ -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
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
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
- 0
Teknik/Configuration/EmailConfig.cs View File

@@ -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