Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #VAR
- mutt_conf=/tmp/.conf
- dirmail=/home/$USER/mail
- # check file
- function check_file(){
- if [ -f $mutt_conf ]; then
- echo "the $mutt_conf and $dirmail files were not deleted"
- else
- echo "the $mutt_conf and $dirmail files have been deleted"
- fi
- }
- # create mail directory
- function foldermail(){
- if [ -e /home/$USER/mail ]
- then
- echo " the $dirmail directory already exists"
- else
- echo " the $dirmail directory does not exist and has been created"
- mkdir /home/$USER/mail
- fi
- }
- # menu del
- function del_menu(){
- title="want to delete the file $mutt_conf and directory $dirmail that were created"
- prompt="Select: "
- options=("Yes" "No")
- echo "$title"
- PS3="$prompt"
- select opt in "${options[@]}" "Quit/Cancel"; do
- case "$REPLY" in
- 1 ) echo -e "YES: " ; shred -u -z -n 20 $mutt_conf ; rm -r $dirmail ; check_file ; read -p "Press ENTER to exit..." xenter ; clear ; reset ; exit ;;
- 2 ) echo -e "NO: " ; check_file ; read -p "Press ENTER to exit..." xenter ; clear ; reset ; exit ;;
- $(( ${#options[@]}+1 )) ) clear; reset ; clear ; reset ; exit;;
- *) echo "Invalid option. Try another one.";continue;;
- esac
- done
- return
- }
- # parameters
- while [ -n "$1" ]
- do
- case "$1" in
- -g)
- mutt_conf(){
- cat > /tmp/.conf <<END
- set mbox_type=maildir
- set mbox="~/mail/inbox/"
- set spoolfile="~/mail/inbox/"
- set folder="~/mail/"
- set record="~/mail/sent/"
- set postponed="~/mail/postponed/"
- # Cont Gmail.
- set from = "$xlogin@gmail.com"
- set realname = "$rname"
- set imap_user = "$xlogin@gmail.com"
- set imap_pass = "$xpass"
- # Editor.
- set editor=vim
- # folder IMAP.
- set folder = "imaps://imap.gmail.com:993"
- set spoolfile = "+INBOX"
- set postponed ="+[Gmail]/Drafts"
- # folder Local.
- set header_cache =~/.mutt/cache/headers
- set message_cachedir =~/.mutt/cache/bodies
- set certificate_file =~/.mutt/certificates
- # SMTP Config.
- set smtp_url = "smtp://$xlogin@smtp.gmail.com:587/"
- set smtp_pass = "$xpass"
- END
- }
- clear ; reset ; foldermail ; echo -e "### TMUTT - GMAIL ###" ;
- read -ep "Login: " xlogin ;
- echo -e "Email: $xlogin@gmail.com" ;
- read -ep "Real name: " rname ;
- echo -e "Password:" ;
- read -s xpass ;
- mutt_conf ; mutt -F $mutt_conf ; del_menu ;
- ;;
- -s)
- mutt_conf(){
- cat > /tmp/.conf <<END
- set mbox_type=maildir
- set mbox="~/mail/inbox/"
- set spoolfile="~/mail/inbox/"
- set folder="~/mail/"
- set record="~/mail/sent/"
- set postponed="~/mail/postponed/"
- # Cont Gmail.
- set from = "$xemail"
- set realname = "$rname"
- set imap_user = "$xemail"
- set imap_pass = "$xpass"
- # Editor.
- set editor=vim
- # folder IMAP.
- set folder = "imaps://$ximap:$xportimap"
- set spoolfile = "+INBOX"
- set postponed ="+[Gmail]/Drafts"
- # folder Local.
- set header_cache =~/.mutt/cache/headers
- set message_cachedir =~/.mutt/cache/bodies
- set certificate_file =~/.mutt/certificates
- # SMTP Config.
- set smtp_url = "smtp://$xlogin@$xsmtp:$xportsmtp/"
- set smtp_pass = "$xpass"
- END
- }
- clear ; reset ; foldermail ; echo -e "### TMUTT - SMTP/IMAP ###" ;
- read -ep "Login: " xlogin ;
- read -ep "Email: " xemail ;
- read -ep "IMAP: " ximap
- read -ep "Port-IMAP: " xportimap
- read -ep "SMTP: " xsmtp
- read -ep "Port-SMTP: " xportsmtp
- read -ep "Real name: " rname ;
- echo -e "Password:" ;
- read -s xpass ;
- mutt_conf ; mutt -F $mutt_conf ; del_menu ;
- ;;
- -h) clear ; reset ; echo "### TMUTT v1b - HELP ###"
- echo "--Options"
- echo "-s |--SMTP - configure smtp and port to send email"
- echo "-g |--GMAIL SMTP - uses smtp and port google default to send emails "
- echo "-c |--LOAD CONFIG - loads a configuration file mutt"
- echo "-cls |--DELETE CONFIGURATION - deletes all configuration files"
- echo "-------------------------"
- echo "**IMPORTANT INFORMATION**"
- echo "**this Shell Script use the package mutt**"
- echo "-------------------------"
- echo "----by Seehrum - 2018----";
- ;;
- -c) clear ; reset ; echo -e "### TMUTT - CONFIG ###" ; read -ep "Path conf: " xpath ; mutt -F $xpath ;
- ;;
- -cls) shred -u -z -n 20 $mutt_conf ; rm -r $dirmail ; clear ; reset ; echo -e "the configuration files have been deleted" ;
- ;;
- -*) echo "tmutt: invalid command - for help use the -h parameter"
- ;;
- *) echo "tmutt: invalid command - for help use the -h parameter"
- esac
- shift
- exit 0
- done
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement