Skip to content

Instantly share code, notes, and snippets.

@igordcard
Forked from anonymous/gmail.sh
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igordcard/9669301 to your computer and use it in GitHub Desktop.
Save igordcard/9669301 to your computer and use it in GitHub Desktop.
#!/bin/bash
function gmail() {
from=$1
user=$1
to=$2
stty -echo </dev/tty;
read -p "Password: " passw < /dev/tty
echo
stty </dev/tty echo
opts="-S smtp-use-starttls \
-S ssl-verify=ignore \
-S smtp-auth=login \
-S smtp=smtp://smtp.gmail.com:587 \
-S from=$from \
-S smtp-auth-user=$user \
-S smtp-auth-password=$passw \
-S ssl-verify=ignore"
mailx -v $opts $to $@
}
gmail $1 $2
@igordcard
Copy link
Author

Now accepts a second argument which is the recipient of the email.

@igordcard
Copy link
Author

Fixed syntax problems and made the email address an argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment