• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

How does Plesk API send data about new email accounts?

F

floatingworld

Guest
How does Plesk create email accounts? Can the Plesk API "send" data about the username and password of new accounts to an external script? I am asking this because we want to use a spam filtering system that our parent company has designed, and we want make it interface with Qmail/Plesk.
 
You can set the event manager to do this kind of stuff.

Event Types available:
Mail account Created
Mail account Updated
Mail account Deleted

You can setup a script such as /tmp/showenv.sh

Code:
#!/bin/bash
set
exit 0

and set the event manager to call this script in a fashion like:
Code:
/tmp/showenv.sh > /tmp/vars.log

This will show you all the environment variables that are available to you. At that time if there is something that you need that you dont have, you can directly query the PSA MySQL databse to lookup anything else.


Code:
#!/bin/bash

#Get LoginPW for Plesk DB
admin_pwd=`cat /etc/psa/.psa.shadow`

#In this example, NEW_DOMAIN_NAME is part of the environemnt from the event
#Get the Domain Name's owner from MySQL based on the odmain name
mysql="mysql -N -B -uadmin -p$admin_pwd psa"
query="SELECT c.login from clients c, domains d where c.id=d.cl_id AND d.displayName='$NEW_DOMAIN_NAME'"
CLIENT_LOGIN=`echo "$query"|$mysql`

#You now have their plesk LoginID in the $CLIENT_LOGIN variable

That was just a very basic example, ubt you can basically get almost anything with that kind of combined approach.

What I do is I use the event manager to call a SH script which invokes a PHP script becuase I want to tie in THEIR API with OUR corporate API so when domains are created, passwords updated, databases, etc we can keep track in our database as well for our billing and usage calculations - and calling an external source API is easier for me in php, but I had to use a SH script to call the php as it didnt work directly calling the php from the event manager for some reason.

I dont see why you couldnt do something similar here
 
Back
Top