Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1013 B

4 years ago
  1. #!/bin/bash
  2. # Put the message, send to stdin, in a variable
  3. m="$(cat -)"
  4. m64="$(echo -e "$m" | base64)"
  5. echo "$m64" > /tmp/test2
  6. tracking_url=$(/home/yigit/.scripts/gen_tracking_url "$m64" 2> /tmp/testerr)
  7. echo $tracking_url > /tmp/test3
  8. # Look at the first argument,
  9. # Use it to determine the account to use
  10. # If not set, assume work
  11. # All remaining arguments should be recipient addresses which should be passed to msmtp
  12. account="$1"
  13. shift 1
  14. cleanHeaders(){
  15. # In the headers, delete any lines starting with markdown
  16. cat - | sed '0,/^$/{/^markdown/Id;}'
  17. }
  18. echo "$@"
  19. echo "$message" | cleanHeaders > /tmp/headers
  20. echo "msmtp -a $account $@"
  21. echo "$message" | sed '/^$/q' | grep -q -i 'markdown: true' \
  22. && msg=$(echo "$message \n$tracking_url" | cleanHeaders | /home/yigit/.scripts/convertToHtmlMultipart && echo 1 >> /tmp/state) || msg=$(echo "$message" | cleanHeaders)
  23. echo "$msg" > /tmp/test
  24. echo "$msg" | notmuch insert --folder="$account/sent" +sent -inbox
  25. echo "$msg" | msmtp -a $account $@