Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Copyright 2016 faraco <skelic3@gmail.com>
- muttrc_config="$HOME/.muttrc"
- clear
- read -n1 -p "Do you want to create ~/.muttrc and fill the credentials right now, or later? (y/n): " userInput
- echo
- case "$userInput" in
- y|yes|Yes|Yes)
- echo "Please fill in the blanks."
- read -p "Your email address (myemail@gmail.com): " userEmail
- read -s -p "Your email password (hi00): " userPassword
- echo
- read -p "Your email name (Anon): " userName
- if [ ! -z "$userEmail" ] && [ ! -z "$userPassword" ] && [ ! "$userName" ]
- then
- cat >> "$muttrc_config" << __EOF__
- set imap_user = "$userEmail"
- set imap_pass = "$userPassword"
- set smtp_url = "smtp://$userEmail@gmail.com@smtp.gmail.com:587"
- set smtp_pass = "$userPassword"
- set from = "$userEmail"
- set realname = "$userName"
- set mbox_type=mbox
- set mbox =+read_inbox
- set folder = imaps://imap.gmail.com
- set spoolfile =+INBOX
- __EOF__
- echo "$muttrc_config has been created. Please open 'mutt' program to try."
- elif [ -z "$userEmail" ] && [ -z "$userPassword" ] && [ -z "$userName" ]
- then
- echo
- echo "One of the credentials is blank. Please try again."
- exit 1
- fi
- ;;
- n|no|No|NO)
- echo "Creating file..."
- cat >> "$muttrc_config" << __EOF__
- set imap_user = "myemail@gmail.com"
- set imap_pass = "mypassword00"
- set smtp_url = "smtp://myemail@gmail.com@smtp.gmail.com:587"
- set smtp_pass = "mypassword00"
- set from = "myemail@gmail.com"
- set realname = "Jack Sparrow"
- set mbox_type=mbox
- set mbox =+read_inbox
- set folder = imaps://imap.gmail.com
- set spoolfile =+INBOX
- __EOF__
- echo
- echo
- echo "Created ~/.muttrc with default content. Please edit the file and change them to your credentials."
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement