Skip to content

Instantly share code, notes, and snippets.

@toodooleedoo
Created February 1, 2015 23:13
Show Gist options
  • Save toodooleedoo/eef94ba9e3bf92ce92be to your computer and use it in GitHub Desktop.
Save toodooleedoo/eef94ba9e3bf92ce92be to your computer and use it in GitHub Desktop.
Linux email in to evernote from command line. Requires Mutt setup.
TITLE="${1}"
CONTENT=${2}
if [ "${TITLE}" = "public" ]; then echo "Link: http://goo.gl/<<<CUT>>>";CONTENT="`date`: ${CONTENT}"; fi
if [ -f "${CONTENT}" ]; then
#Allowed extensions to send attachment and content
EXTENSION_MAP="sh"
if `grep -q "${CONTENT##*.}" <<<$EXTENSION_MAP`; then
mutt -s "${TITLE} (mailedin - ${CONTENT}) +" <<<CUT>>>@m.evernote.com -a ${CONTENT} <${CONTENT}
exit
fi
#Known Compresseion types send only as attachment
EXTENSION_MAP="zip gz tar"
if `grep -q "${CONTENT##*.}" <<<$EXTENSION_MAP`; then
echo "Compressed: " |mutt -s "${TITLE} (mailedin - ${CONTENT}) +" <<<CUT>>>@m.evernote.com -a ${CONTENT}
exit;
fi
#Zip everything else
gzip -c ${CONTENT} > /tmp/${CONTENT}.gz
echo "${CONTENT}" |mutt -s "${TITLE} (mailedin - ${CONTENT}) +" <<<CUT>>>@m.evernote.com -a /tmp/${CONTENT}.gz
rm /tmp/${CONTENT}.gz
else
#sending only text no attachment
echo "${CONTENT}" |mutt -s "${TITLE} (mailedin) +" <<<CUT>>>@m.evernote.com
fi
Install Mutt Sending mail with mutt (bwisoukene.bestwestern.com - .muttrc)
sudo yum install mutt
mkdir -p ~/.mutt/cache/headers
mkdir ~/.mutt/cache/bodies
touch ~/.mutt/certificates
you need to open mutt once
#Send a mail with file in content and as an attachment
mutt -s "test" <<<CUT>>>@live.com -a ./megemenusize.sh <megemenusize.sh
Use this for your gmail and save as ~/.muttrc
You need to open mutt once to accept certificates
Send file through email to evernote (cent - enfs.sh)
# A basic .muttrc for use with Gmail
# Change the following six lines to match your Gmail account details
set imap_user = "<<<CUT>>>@gmail.com"
set imap_pass = "<<<CUT>>>"
set smtp_url = "smtp://[email protected]:587/"
set smtp_pass = "<<<CUT>>>"
set from = "<<<CUT>>>@gmail.com"
set realname = "Eric Soukenka"
# Change the following line to a different editor you prefer.
set editor = "vim"
# Basic config, you can leave this as is
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set imap_check_subscribed
set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
set postponed = "+[GMail]/Drafts"
set record = "+[GMail]/Sent Mail"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no
set include
set sort = 'threads'
set sort_aux = 'reverse-last-date-received'
set auto_tag = yes
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc
alternative_order text/plain text/html *
auto_view text/html
bind editor <Tab> complete-query
bind editor ^T complete
bind editor <space> noop
# Gmail-style keyboard shortcuts
macro index,pager y "<enter-command>unset trash\n <delete-message>" "Gmail archive
message"
macro index,pager d "<enter-command>set trash=\"imaps://imap.googlemail.com/[GMail]/Bin\"\n
<delete-message>" "Gmail delete message"
macro index,pager gi "<change-folder>=INBOX<enter>" "Go to inbox"
macro index,pager ga "<change-folder>=[Gmail]/All Mail<enter>" "Go to all mail"
macro index,pager gs "<change-folder>=[Gmail]/Starred<enter>" "Go to starred messages"
macro index,pager gd "<change-folder>=[Gmail]/Drafts<enter>" "Go to drafts"# A basic .muttrc
for use with Gmail
# Change the following six lines to match your Gmail account details
set imap_user = "[email protected]"
set imap_pass = "pinklubbles"
set smtp_url = "smtp://[email protected]:587/"
set smtp_pass = "pinklubbles"
set from = "[email protected]"
set realname = "Eric Eric"
# Change the following line to a different editor you prefer.
set editor = "vim"
# Basic config, you can leave this as is
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set imap_check_subscribed
set hostname = gmail.com
set mail_check = 120
set timeout = 300
set imap_keepalive = 300
set postponed = "+[GMail]/Drafts"
set record = "+[GMail]/Sent Mail"
set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates
set move = no
set include
set sort = 'threads'
set sort_aux = 'reverse-last-date-received'
set auto_tag = yes
ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc
alternative_order text/plain text/html *
auto_view text/html
bind editor <Tab> complete-query
bind editor ^T complete
bind editor <space> noop
# Gmail-style keyboard shortcuts
macro index,pager y "<enter-command>unset trash\n <delete-message>" "Gmail archive
message"
macro index,pager d "<enter-command>set trash=\"imaps://imap.googlemail.com/[GMail]/Bin\"\n
<delete-message>" "Gmail delete message"
macro index,pager gi "<change-folder>=INBOX<enter>" "Go to inbox"
macro index,pager ga "<change-folder>=[Gmail]/All Mail<enter>" "Go to all mail"
macro index,pager gs "<change-folder>=[Gmail]/Starred<enter>" "Go to starred messages"
macro index,pager gd "<change-folder>=[Gmail]/Drafts<enter>" "Go to drafts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment