• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Please beaware of a breaking change in the REST API on the current Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

Question Script Change Password all Mailbox

marcelhalls

New Pleskian
Server operating system version
Ubuntu 22.04
Plesk version and microupdate number
18.0.61
I need to change the password for all email boxes on a specific domain in order to migrate the boxes with imapsync.
I tried the script below but when I run it, it returns the following error: " The specified email address is not valid. Specify a valid one that matches the following pattern: [email protected]. "

Below is the script I used:

Bash:
#!/bin/bash

# Set the specific domain
DOMAIN="example.com"
# Set new password
NEW_PASSWORD="newSecurePassword"

# Get the list of email accounts for the specified domain
ACCOUNTS_EMAIL=$(plesk bin mail -l | grep "@$DOMINIO" | awk '{print $1}')

# Iterate over each email account and change the password
for EMAIL in $CONTAS_EMAIL; of
 echo "Changing account password: $EMAIL"
 plesk bin mail --update "$EMAIL" -passwd "$NEW_SENHA"
done

echo "Password change completed."
 
Last edited by a moderator:
Back
Top