Current Path : /bin/ |
Current File : //bin/test_email.sh |
#!/bin/bash export HOME=/home/bitrix tmp_dir=/tmp/mail args=$@ if [[ ! -d $tmp_dir ]]; then mkdir $tmp_dir chmod 777 $tmp_dir fi message_body="" while read line; do message_body="$message_body$line\n" done < /dev/stdin tmp_file=$(mktemp $tmp_dir/$(date +%Y%m%d_%H%M%S)_XXXXXXXXX) echo "=========================================" > $tmp_file echo "ARGV: /usr/bin/msmtp --debug -t -i $args" >> $tmp_file echo "=========================================" >> $tmp_file echo -e "BODY: $message_body" >> $tmp_file echo "=========================================" >> $tmp_file # send message echo -e "$message_body" | /usr/bin/msmtp --debug -t -i $args >> $tmp_file && 2>&1