mirror of
https://github.com/imapsync/imapsync.git
synced 2025-07-24 03:00:25 +02:00
1.920
This commit is contained in:
parent
eafd200ec0
commit
62531f58cd
300 changed files with 9212 additions and 88495 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue