File: //bigscoots/cpanel/template_generator.sh
#!/bin/bash
# Define the paths to the different template files
welcome_email_template="/bigscoots/cpanel/templates/welcome_email.txt"
placeholder1_template="/bigscoots/cpanel/templates/placeholder1.txt"
placeholder2_template="/bigscoots/cpanel/templates/placeholder2.txt"
# Display the menu of options
echo "Select a template:"
echo "1. Welcome Email"
echo "2. Placeholder 1"
echo "3. Placeholder 2"
read -p "Enter your choice: " choice
# Determine which template to use based on the user's choice
case $choice in
1) template_file=$welcome_email_template;;
2) template_file=$placeholder1_template;;
3) template_file=$placeholder2_template;;
*) echo "Invalid choice"; exit 1;;
esac
# Extract the necessary variables from the environment
WHM_URL="${HOSTNAME}"
PORTAL_URL="https://portal.bigscoots.com/clientarea/services/&service=${HOSTNAME%%.*}"
ONE_TIME_LOGIN_URL="$(whmlogin)"
SSH_HOST="${HOSTNAME}"
SSH_PORT="2222"
# Replace placeholders in the template with actual values
template=$(cat "$template_file")
template=${template/\$\{WHM_URL\}/$WHM_URL}
template=${template/\$\{PORTAL_URL\}/$PORTAL_URL}
template=${template/\$\{ONE_TIME_LOGIN_URL\}/$ONE_TIME_LOGIN_URL}
template=${template/\$\{SSH_HOST\}/$SSH_HOST}
template=${template/\$\{SSH_PORT\}/$SSH_PORT}
# Send email using the template
echo
echo
echo
echo "$template"