This commit is contained in:
Nick Bebout 2019-07-02 18:17:46 -05:00
parent eafd200ec0
commit 62531f58cd
300 changed files with 9212 additions and 88495 deletions

View file

@ -1,7 +1,29 @@
#!/usr/bin/ruby
require 'mail'
message = Mail.read_from_string(STDIN.read)
message.from = 'emiliano.heyns@han.nl' if message.sender.nil?
puts message.to_s
# $Id: addFromIfMissing,v 1.6 2018/08/31 11:21:54 gilles Exp gilles $
# Credits: Emiliano Heyns
# https://github.com/imapsync/imapsync/issues/54
# https://github.com/mikel/mail
# Test example in command line:
# { echo "Date: Fri, 31 Aug 2018 12:58:59 +0000" ; echo ; echo "Hello World!" ; } | ./addFromIfMissing
# Add mail gem with the command:
# gem install mail
require 'mail'
data = STDIN.read
exit(0) if data.strip == ''
message = Mail.read_from_string(data)
if message.from && message.from.length > 0
puts data
else
message.from = 'emiliano.heyns@han.nl'
puts message.to_s
end