Re: [Emerald] FW: Mail Server Crash

Dale E. Reed Jr. ( (no email) )
Sat, 13 Nov 1999 16:09:16 -0800

Kelly Wright wrote:
>
> WE had our diskdrive crash on NTMail. We were going to move to MailSite. I
> have Mail site running on our primary domain name but can't get other domain
> names to work with the Emerald db. Any ideas on what I need to do?

How are you doing the other domains? The original mailsite proc only
allowed the email field to be a user in the group's domain.

Here is an updated proc that has support for aliases, the email field,
and allows the user to receive email while they are expired, but not
read their email.

CREATE PROCEDURE VerifyMailUser @username varchar(32), @domain
varchar(32), @esid integer AS
CREATE TABLE #AccountIDs (AccountID INT)
INSERT INTO #AccountIDs
SELECT AccountID FROM SubAccounts sa WHERE Login = @username
UNION
SELECT AccountID FROM SubAccounts WHERE Email = @username
UNION
SELECT AccountID FROM SubAccounts WHERE Shell = @username
UNION
SELECT AccountID FROM SubAccounts WHERE Email = @username + '@' +
@domain

DELETE ai
FROM #AccountIDs ai, SubAccounts sa, MasterAccounts ma
WHERE ai.AccountID = sa.AccountID
AND sa.CustomerID = ma.CustomeriD
AND (sa.Active <> 1 OR ma.Active <> 1)

IF (SELECT COUNT(AccountID) FROM #AccountIDs) = 0
INSERT INTO #AccountIDs
SELECT AccountID FROM Aliases WHERE Alias = @username + '@' + @domain

Select Login, Shell, Email,@domain AS MailDomain,
CASE WHEN (ma.OverLimit > 0 AND ma.OverLimit > ma.Balance) OR
DateAdd(Day, (ma.Extension+ma.OverDue+1), maExpireDate) < GetDate()
THEN RIGHT(CONVERT(VARCHAR(10),RAND()),4) +
RIGHT(CONVERT(VARCHAR(10),RAND()),4)
ELSE sa.Password END AS Password, HomeDir
From MasterAccounts ma, SubAccounts sa, Groups g, AccountTypes at1
Where ma.CustomerID = sa.CustomerID
AND sa.AccountID IN (SELECT AccountID FROM #AccountIDs)
AND ma.GroupID = g.GroupID
AND g.DomainID IN (SELECT d.DomainID FROM Domains d WHERE d.MailDomain
= @domain)
AND at1.AccountType = sa.AccountType
AND at1.ExternalSystemID = @esid
DROP TABLE #AccountIDs
GO

-- 

Dale E. Reed Jr. Emerald and RadiusNT__________________________________________IEA Software, Inc. www.iea-software.com

For more information about this list (including removal) go to:http://www.iea-software.com/support/maillists/liststart