howtos:mail_tester
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howtos:mail_tester [15/10/2007 16:46] – domingo | howtos:mail_tester [02/12/2018 21:34] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Mail Tester Script ===== | ||
+ | |||
+ | The script is based on zenity and the Postfix mail generator // | ||
+ | |||
+ | There are a couple of more options available but I don't need them at the time. If you need them you can use this as a starting point and then just add them yourself. | ||
+ | |||
+ | < | ||
+ | #!/bin/bash | ||
+ | |||
+ | # Basic variables | ||
+ | OUTFILE="/ | ||
+ | rm $OUTFILE 2>/ | ||
+ | DATETIME=`date +%H\:%M` | ||
+ | # -f | ||
+ | FROM=" | ||
+ | # -t | ||
+ | RECIPIENT=" | ||
+ | # -m | ||
+ | MSGCOUNT=10 | ||
+ | # -M | ||
+ | HELOHOST=" | ||
+ | # -S | ||
+ | SUBJECT=" | ||
+ | HOST="" | ||
+ | |||
+ | # Check if Postfix is installed | ||
+ | INSTALLED=`which smtp-source` | ||
+ | if [ " | ||
+ | then | ||
+ | zenity --error | ||
+ | exit 0 | ||
+ | fi | ||
+ | |||
+ | # Ask for the host | ||
+ | HOST=`zenity --entry-text=$HOST --entry --text=" | ||
+ | |||
+ | # Breakout if no host is specified | ||
+ | if [ " | ||
+ | then | ||
+ | exit 0 | ||
+ | fi | ||
+ | |||
+ | # Ask for a sender address | ||
+ | FROM=`zenity --entry-text=$FROM --entry --text=" | ||
+ | |||
+ | # Ask for recipient | ||
+ | RECIPIENT=`zenity --entry-text=$RECIPIENT --entry --text=" | ||
+ | |||
+ | # Ask for messagecount | ||
+ | MSGCOUNT=`zenity --entry-text=$MSGCOUNT --entry --text=" | ||
+ | |||
+ | # Ask for helo host | ||
+ | HELOHOST=`zenity --entry-text=$HELOHOST --entry --text=" | ||
+ | |||
+ | # Ask for subject | ||
+ | SUBJECT=`zenity --entry-text=$SUBJECT --entry --text=" | ||
+ | |||
+ | # Collect command | ||
+ | CMD=" | ||
+ | |||
+ | # Executing commands | ||
+ | $CMD 2> | ||
+ | |||
+ | # Test result | ||
+ | SIZE=`ls -lh $OUTFILE | awk ' | ||
+ | if [ $SIZE -gt 0 ] | ||
+ | then | ||
+ | cat $OUTFILE | zenity --text-info --width 530 | ||
+ | exit 0 | ||
+ | fi | ||
+ | |||
+ | echo " | ||
+ | |||
+ | rm $OUTFILE | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
howtos/mail_tester.txt · Last modified: 02/12/2018 21:34 by 127.0.0.1