forwarder_create_pre.sh output question

Panormitis

Verified User
Joined
Sep 13, 2014
Messages
37
Hello,
I have created a forwarder_create_pre.sh script in /usr/local/directadmin/scripts/custom because I want to disallow creation of forwarders to external e-mail addresses (such as [email protected]). The user is only allowed to forward e-mails to its own domain names.
The script works, but I'm not satisfied with the error message produced:

Error creating forwarder

Script output: /usr/local/directadmin/scripts/custom/forwarder_create_pre.sh
Forwarders to external e-mail addresses are not allowed!
If there a way to remove "Script output: /usr/local/directadmin/scripts/custom/forwarder_create_pre.sh" from the error message?
In case anyone wants to use the script, feel free, here is the code:
Code:
#!/bin/bash

# Regex for e-mail validation:
email_regex="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"

# Split $value by commas and check each part:
IFS=',' read -ra addresses <<< "$value"

for email_address in "${addresses[@]}"; do
  # Trim whitespace (just in case):
  email_address=$(echo "$email_address" | xargs)
 
  # Check if it's a valid e-mail address:
  if [[ $email_address =~ $email_regex ]]; then
    # Extract domain name:
    domain_name="${email_address##*@}"
    
    # Check if domain_name exists in domains.list:
    if ! grep -Fxq "$domain_name" /usr/local/directadmin/data/users/"$username"/domains.list; then
      echo "Forwarders to external e-mail addresses are not allowed!"
      exit 1
    fi
  fi
done

# If all checks passed, allow the forwarder.
exit 0
 
Hello,

If the exact line with a script path has its own CSS style (name, id attributes), you might use CSS to hide it. Otherwise you will need to contact Directadmin for it, or post a feature request.
 
Hello,

If the exact line with a script path has its own CSS style (name, id attributes), you might use CSS to hide it. Otherwise you will need to contact Directadmin for it, or post a feature request.
Code:
<pre class="content whitespace-pre-wrap">
<span><b>Script output</b>: /usr/local/directadmin/scripts/custom/forwarder_create_pre.sh
Forwarders to external e-mail addresses are not allowed!</span>
</pre>
Thank you for your reply.
The error message is in <span></span> as a whole, so using display: none with css, would hide the whole error message, I wouldn't like that.
I'll post a feature request.
 
Back
Top