OK, found it by myself - the address attribute should be the domain name (w/o the @)
I'm attaching the code in PHP - basically you need only to edit the IN LDIF and/or OUT SQL filenames...
Don't forget to check manually if the script is doing what you want!
Use at your own risk!