Compare commits
2 commits
6797f80d0e
...
c29a2ec808
Author | SHA1 | Date | |
---|---|---|---|
c29a2ec808 | |||
cf0e371b5f |
2 changed files with 49 additions and 1 deletions
|
@ -53,4 +53,52 @@ function hotspot
|
|||
sudo sysctl net.ipv4.ip_default_ttl=65
|
||||
end
|
||||
|
||||
function send-email
|
||||
set -l from "guix-home@ethanreece.com"
|
||||
set -l to ""
|
||||
set -l subject ""
|
||||
|
||||
# Parse the arguments
|
||||
for arg in $argv
|
||||
switch $arg
|
||||
case '--from=*'
|
||||
set from (string split '=' -- $arg)[2]
|
||||
case '--to=*'
|
||||
set to (string split '=' -- $arg)[2]
|
||||
case '--subject=*'
|
||||
set subject (string split '=' -- $arg)[2]
|
||||
end
|
||||
end
|
||||
|
||||
set temp_file (mktemp)
|
||||
|
||||
# Add required headers to the temporary file
|
||||
echo "To: $to" >>$temp_file
|
||||
echo "From: $from" >>$temp_file
|
||||
echo "Subject: $subject" >>$temp_file
|
||||
echo "" >>$temp_file # Add a blank line to separate headers from the body
|
||||
|
||||
# Open the temporary file with $EDITOR
|
||||
$EDITOR $temp_file
|
||||
|
||||
# Extract the recipient from the file if not provided as an argument
|
||||
if test -z "$to"
|
||||
set to (grep -m 1 '^To: ' $temp_file | sed 's/^To: //')
|
||||
end
|
||||
|
||||
echo "Do you want to send the email? (y/n)"
|
||||
read -l response
|
||||
|
||||
if test "$response" = y
|
||||
# Send the email using msmtp
|
||||
msmtp $to <$temp_file
|
||||
echo "Email sent."
|
||||
else
|
||||
echo "Email not sent."
|
||||
end
|
||||
|
||||
# Delete the temporary file
|
||||
rm $temp_file
|
||||
end
|
||||
|
||||
fish_add_path -g
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[user]
|
||||
signingkey = CE4C5BAE04052CF4
|
||||
signingkey = 0A16B8D6C6FC259BC96C9FF4198E9EB433DB1B28
|
||||
email = git@ethanreece.com
|
||||
name = Ethan Reece
|
||||
[commit]
|
||||
|
|
Loading…
Add table
Reference in a new issue