• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    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. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

NEW_MAILBOX variable from 'Mail account updated' Event

Hostit

New Pleskian
---------------------------------------------------------------
PRODUCT, VERSION, MICROUPDATE, OPERATING SYSTEM, ARCHITECTURE
Parallels Plesk, 11.5, .30_build115130819.13, Debian 7.0, Intel 64bit

PROBLEM DESCRIPTION

When triggering the events 'Mail account created' or 'Mail account modified' the returned variable NEW_MAILBOX will always state TRUE regardless of the mailbox option being ticked or not ticked on the 'New mail account' option located on the 'Mail' tab of a subscription.

STEPS TO REPRODUCE

1: Log in to plesk.
2. Select 'Tools & Settings'
3: Select 'Event Manager'
4: Select 'Add New Event Handler'
5: Select Event 'Mail account updated'
6: Enter in '/usr/bin/php /root/scripts/dbmail/mail_mod.php' to the Command box.
7: Click 'Ok'
8: Select 'Add New Event Handler'
9: Select Event 'Mail account created'
10: Enter in '/usr/bin/php /root/scripts/dbmail/mail_add.php' to the Command box.
11: Click 'Ok'
12: Log in via ssh to the server.
13: create file '/root/scripts/dbmail/mail_mod.php'
14: Enter in following code
<?php
$file = '/tmp/mailtest.txt';
$current = file_get_contents($file);
$current .= print_r(get_defined_vars(), true);
file_put_contents($file, $current);
?>
15: Save file
16: create file '/root/scripts/dbmail/mail_add.php'
17: Enter in following code
<?php
$file = '/tmp/mailtest.txt';
$current = file_get_contents($file);
$current .= print_r(get_defined_vars(), true);
file_put_contents($file, $current);
?>
18: Save file
19: Search for test account on plesk panel.
20: Click on the test subscription.
21: Select the 'Mail' Tab
22: Click 'Create Email Address'
23: Enter in an email address prefix (admin)
24: Enter a Password
25: Enter in 'Confirm password'
25: Untick "Mailbox"
26: Click 'Ok'
27: Click on the newly created email address.
28: Change the password.
29: Click 'Ok'
30: Search the file '/tmp/mailtest.txt' on the server for the value [NEW_MAILBOX] => false

ACTUAL RESULT

[NEW_MAILBOX] => true

EXPECTED RESULT

[NEW_MAILBOX] => false

ANY ADDITIONAL INFORMATION

I submitted this with parallels support and they stated that the variable NEW_MAILBOX will always return as TRUE regardless of if the mailbox option is ticked or not. They also stated the NEW_MAILBOX variable will be true regardless of any action taken on the panel with mail accounts.
The actual documentation on this variable is very sparse

Component name/description Old component value New component value
Mailbox old_mailbox new_mailbox

We previously had some code that would trigger on this variable and would create a mail account on our mail server with or without a mailbox.

if (!strcmp(getenv('NEW_MAILBOX'),"true") && !strcmp(getenv('OLD_MAILBOX'),"false")){
//Create a mailbox on the external mail service
}

if (!strcmp(getenv('NEW_MAILBOX'),"false") && !strcmp(getenv('OLD_MAILBOX'),"true")){
//Create a mail forwarder on the external mail service
}

--------------------------------------------------------------

At some point this variable has stopped working with newer versions of plesk.
Having a variable that is always true regardless of what is done when creating a mail account seems pointless and requesting a new feature that was already there in older versions doesnt seem like something that should be requested on a new feature request.

QUESTION: Is there anyway to get this functionality restored other than requesting it gets re added via https://plesk.uservoice.com/ ?

I appreciate any help with the question Or any opinions you have on the functionality the NEW_MAILBOX variable should have.

Kind Regards,
Ben
 
Back
Top