Server mail BCC to address@servername

I apologize if this is a dumb/redundant question.

I have an Ubuntu Server 16.04, main use is as a test environment and learning experience. I have SSH setup on this server that runs fine. I have mailutils ssmtp installed to use a cron job to send me an email every day with my external IP. I'm too lazy/cheap at this point to setup a static IP.

Whenever I get this email, it automatically BCCs address@servername and ip@servername. I can't seem to figure out where/why this is happening.

Below is the script I'm using.

Code is borrowed from another source not my own.

#!/bin/sh
SUBJ="Server IP Address"
EMAIL=""
ip2=""
ip2=$(wget -qO- )
echo "$ip2" | mail -s $SUBJ $EMAIL
exit
fi

I also have this issue when Logwatch sends out the report email except to root@servername.

Please let me know if I am neglecting to give more information or if this is just really dumb.

I tried to check for a possible fix already but might have missed it due to wording. Thank you for your help.

1 Answer

Found the fix when trying to fix something else, funny how that works.

#!/bin/sh
(wget -qO- ) > ip.txt
mail -s "HomeOne IP Address" < ip.txt 

For whatever reason the variables in the bash script were causing the mail to weird out and try and send it to strange and nonexistent email addresses.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like