0

In exim4, I use following pipe to send a message to a python script, process it, and upload it to django:

send_to_django_mailbox:
  driver = pipe
  command = /usr/local/bin/python /etc/exim4/conf.d/transport/send_mail.py $message_body  $message_headers_raw
  return_path_add
  delivery_date_add

instead of passing in $message_body and $message_headers_raw I would like to pass in the very raw message, without any substitution. How can I achieve it? I cannot find a variable message_raw or similar.

Roman
  • 3,825
  • 3
  • 20
  • 33
vikingosegundo
  • 135
  • 1
  • 9

2 Answers2

1

Exim can pipe message to another process, and from that process message is accessible via /dev/stdin file. For example, from shell we can read message line by line like that:

#!/bin/sh

while read line
do 
  echo (( $line ))
done < /dev/stdin
#####
Kondybas
  • 6,864
  • 2
  • 19
  • 24
0

Ok, stupid me, I should had read the documentation more carefully:

The plain message is send to the script via stdin, I don't have to pass it in via command line parameters.

in python it would be like

import sys

for line in sys.stdin:
    the_file.write(line)
vikingosegundo
  • 135
  • 1
  • 9