HEX
Server: Apache
System: Linux viper.innovativeinternet.net 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64
User: thetradingroom (1095)
PHP: 8.3.25
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //ibin/mail-test
#!/bin/sh
# Argument checks
if [[ ( $# == "--help" ||  $# == "-h") || ! ($# -eq 1 && $1 =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$) ]]; then
    echo -e "\nThis script takes an email address as argument." 
    echo -e "Usage:\n$0 user@example.com \n" 
    exit 1
fi
# Define variables
LOCAL_HOSTNAME=$(uname -n)
EMAIL_ADDR="$1"
REMOTE_LOCAL_ADDR="${EMAIL_ADDR%@*}"
REMOTE_DOMAIN="${EMAIL_ADDR#*@}"
#REMOTE_MX=$(dig +short $REMOTE_DOMAIN MX |head -n1 |cut -d ' ' -f 2)
#REMOTE_MX="meteor.innovativeinternet.net"
#REMOTE_MX="gallardo.innovativeinternet.net"
#REMOTE_MX="garage.innovativeinternet.net"
#REMOTE_MX="garage.innovativeinternet.net"
#REMOTE_MX="sunwiring-com.mail.protection.outlook.com"
#REMOTE_MX="mgw.innovativeinternet.net"
REMOTE_MX="webmail.brickellmotors.com"
SMTP_PORT="25"
DISPLAY_NAME="Innovative E-Mail Security Gateway Test"
#SENDER="jack@BrickellMotors.com"
#SENDER="NoReply@InnovativeInternet.com"
#SENDER="NoReply@test.photopros.com"
#SENDER="NoReply@brimmats.com"
#SENDER="NoReply@phxwebserver.com"
SENDER="Jack@InnovativeInternet.com"
#REPLY_TO=$SENDER
MESSAGE="Content-type: text/html\n\n<img src="https://mgw.innovativeinternet.net:8006/pve2/images/email-protection-icon.png" width="357" height="50" alt=""/><br><br>Hello $EMAIL_ADDR,<br> This test message is from the E-Mail Security Gateway in order to confirm relaying of your email for domain: $REMOTE_DOMAIN<br><br>Should you experience any issues reach out to your IT Department."
INVALID_RECIPIENT=$1
RELAY_TEST="test@example.com"
DATE=$(date '+%a, %d %b %Y %H:%M:%S %z')

# Check if an MX record was returned for the domain
echo 
[ -z "$REMOTE_MX" ] && echo "Failed to get MX record from \"$REMOTE_DOMAIN\"" && exit 1 || echo "Got MX:\"$REMOTE_MX\" for DOMAIN:\"$REMOTE_DOMAIN\""

# Populate array with SMTP commands to run
SMTP_commands=( \
    "HELO $LOCAL_HOSTNAME" \
    "MAIL FROM: <$SENDER>" \
    "RCPT TO: <$EMAIL_ADDR>" \
    "DATA" \
    "To: <$EMAIL_ADDR>\r\nFrom: $DISPLAY_NAME <$SENDER>\r\nReply_To:<$REPLY_TO>\r\nSubject: Test E-Mail Message.\r\nDate: $DATE\r\n$MESSAGE\r\n." \
    "quit"
)
# Define sending function
email_smtp () {
    echo "Trying connect to MX:\"$REMOTE_MX\""
    echo
    exec 3<>/dev/tcp/$REMOTE_MX/$SMTP_PORT
    read -u 3 reply
    echo "$reply"
    # Set internal field separator for "SMTP_commands" array looping
    IFS=""
    # Loop over "SMTP_commands" array
    for i in ${SMTP_commands[@]}
    do
        echo "----Sending Data:"
        echo "$i"
        echo -en "$i\r\n" >&3
        read -u 3 reply
        echo "----Server Reply:"
        echo "$reply"
    done
}
#Call senderfunction
email_smtp