Advertisement
Guest User

Untitled

a guest
Dec 30th, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Copyright 2016 faraco <skelic3@gmail.com>
  4.  
  5. muttrc_config="$HOME/.muttrc"
  6. clear
  7. read -n1 -p "Do you want to create ~/.muttrc and fill the credentials right now, or later? (y/n): " userInput
  8. echo
  9.  
  10. case "$userInput" in
  11. y|yes|Yes|Yes)
  12. echo "Please fill in the blanks."
  13.  
  14. read -p "Your email address (myemail@gmail.com): " userEmail
  15. read -s -p "Your email password (hi00): " userPassword
  16. echo
  17. read -p "Your email name (Anon): " userName
  18.  
  19. if [ ! -z "$userEmail" ] && [ ! -z "$userPassword" ] && [ ! "$userName" ]
  20. then
  21.  
  22. cat >> "$muttrc_config" << __EOF__
  23. set imap_user = "$userEmail"
  24. set imap_pass = "$userPassword"
  25. set smtp_url = "smtp://$userEmail@gmail.com@smtp.gmail.com:587"
  26. set smtp_pass = "$userPassword"
  27. set from = "$userEmail"
  28. set realname = "$userName"
  29. set mbox_type=mbox
  30. set mbox =+read_inbox
  31. set folder = imaps://imap.gmail.com
  32. set spoolfile =+INBOX
  33.  
  34. __EOF__
  35.  
  36. echo "$muttrc_config has been created. Please open 'mutt' program to try."
  37.  
  38. elif [ -z "$userEmail" ] && [ -z "$userPassword" ] && [ -z "$userName" ]
  39. then
  40. echo
  41. echo "One of the credentials is blank. Please try again."
  42.  
  43. exit 1
  44. fi
  45. ;;
  46.  
  47. n|no|No|NO)
  48.  
  49. echo "Creating file..."
  50.  
  51. cat >> "$muttrc_config" << __EOF__
  52. set imap_user = "myemail@gmail.com"
  53. set imap_pass = "mypassword00"
  54. set smtp_url = "smtp://myemail@gmail.com@smtp.gmail.com:587"
  55. set smtp_pass = "mypassword00"
  56. set from = "myemail@gmail.com"
  57. set realname = "Jack Sparrow"
  58. set mbox_type=mbox
  59. set mbox =+read_inbox
  60. set folder = imaps://imap.gmail.com
  61. set spoolfile =+INBOX
  62.  
  63. __EOF__
  64. echo
  65. echo
  66. echo "Created ~/.muttrc with default content. Please edit the file and change them to your credentials."
  67.  
  68. ;;
  69. esac
  70.  
  71. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement