API or Database

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
moloki
Normal user
Normal user
Posts: 35
Joined: 2013-01-03 10:16

API or Database

Post by moloki » 2013-01-03 10:18

Hi. I'm new to Hmailserver and have a quick question.
I see that there is an API to develop against Hmailserver but can't you just add new users/accounts,Domains directly to the database(if you are using external DB like MS SQL/Mysql) ? is this not possible?

User avatar
mattg
Moderator
Moderator
Posts: 20112
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: API or Database

Post by mattg » 2013-01-03 10:35

Yes it is possible
Using the API is better though because when a new account is created for instance an 'Inbox' is also created. When you add the detail directly to the database, you need to then manually create an 'Inbox' before mail is delivered to that account or you will get errors.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

moloki
Normal user
Normal user
Posts: 35
Joined: 2013-01-03 10:16

Re: API or Database

Post by moloki » 2013-01-03 11:13

ahh thanks.
The inbox, is that just a file?

User avatar
mattg
Moderator
Moderator
Posts: 20112
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: API or Database

Post by mattg » 2013-01-03 15:47

moloki wrote:The inbox, is that just a file?
No
It is another database entry, in a different table
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

moloki
Normal user
Normal user
Posts: 35
Joined: 2013-01-03 10:16

Re: API or Database

Post by moloki » 2013-01-03 16:35

ok.
so you can insert in all relevant tables and it will work without API?
basically I wan't to write a few scripts to create users/inboxes etc and I don't wish to use the API if it's not necessary.

User avatar
mattg
Moderator
Moderator
Posts: 20112
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: API or Database

Post by mattg » 2013-01-03 16:53

yes that's correct, you can just script to insert into the database.

Some stuff is cached in hMailserver, so you should also restart the hMailserver service after you are done, to be sure that the cache is refreshed.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

moloki
Normal user
Normal user
Posts: 35
Joined: 2013-01-03 10:16

Re: API or Database

Post by moloki » 2013-01-03 17:08

ok Cool. thx alot. I will do some tests.

Cheers

User avatar
dzekas
Senior user
Senior user
Posts: 2486
Joined: 2005-10-13 21:28
Location: Lithuania

Re: API or Database

Post by dzekas » 2013-01-03 20:05

moloki wrote:ok.
so you can insert in all relevant tables and it will work without API?
You are talking about making custom changes in internal application database data. If you don't use APIs provided by application and make DB changes directly, you are out of application support. Same for this app and for any other application with internal application data stored in database. You are out of support, if you execute any RW operation on application database without vendor's approval.

moloki
Normal user
Normal user
Posts: 35
Joined: 2013-01-03 10:16

Re: API or Database

Post by moloki » 2013-01-08 14:26

hmm I thought the whole point of having a database of the users/Accounts/domains would be to easier integrate to your own API..
All I do is add rows to hm_Accounts and hm_Domains via a webpage. thats all.

Post Reply