Mailbox creation via SQL trigger

Discussion for developers using MailEnable.
Post Reply
Wholesaledial
Posts: 2
Joined: Wed Jan 15, 2014 2:11 am

Mailbox creation via SQL trigger

Post by Wholesaledial »

Hello, we are looking to migrate from Vircom modusMail to MailEnable and continue using our existing back office billing package. What I need to be able to do is to create a mailbox in MailEnable via an SQL trigger (INSERT, UPDATE, and DELETE; insert for adding, update for password changes, and delete for removal). I've examined the MailEnable tables and I have written triggers to perform inserts into the tables. Once the users are put into the table they show up in the MainEnable program under the correct Post Office however I can not log into the accounts in the MailEnable web mail client. It tells me the user is unknown or disabled.

Has anyone done something like this?

For reference, here is a sample of my SQL INSERT trigger:

Code: Select all

	DECLARE @domainName nvarchar(64)
	DECLARE @smtpUserName nvarchar(64)
	DECLARE @emailAddress nvarchar(256)
	DECLARE @emailPassword nvarchar(256)

	SELECT @domainName = [domainname] from inserted
	SELECT @smtpUserName = [smtpusername] from inserted
	SELECT @emailAddress = [email] from inserted
	SELECT @emailPassword = [epass] from inserted

	INSERT INTO [MailEnable].[dbo].[AUTH] (UserName, Password, Account, Status, Rights)
	VALUES (@emailAddress, @emailPassword, @domainName, '1', 'USER')

	INSERT INTO [MailEnable].[dbo].[MAILBOX] (Postoffice, Mailbox, RedirectStatus, Status, SizeLimit, Size)
	VALUES (@domainName, @smtpUserName, '0', '1', '-1', '0')

Post Reply