Jari Aalto asked,
| Does anyone have ideas how I can "stack" th3e fieds before I
| call formail. I'm trying to minmize the called formail processes,
| because I now do:
|
| :0 fh
| * flag1 ?? yes
| | formail -A "X-header1: value"
|
| :0 fh
| * flag2 ?? yes
| | formail -A "X-header1: value"
|
| :0 fh
| | formail -A "X-my: required"
|
| ...
|
| But I'd like to call formail only onece with all headers in variables,
| like this
|
| field1 = "" field2 = ""
| :0
| * flag1 ?? yes
| { field1 = "-A \"X-header1: value\"" }
|
| :0
| * flag2 ?? yes
| { field2 = "-A \"X-header2: value\"" }
|
|
| # Call only formail once with all headers known
| :0
| | formail -A "X-my: required" $field1 $field2
The problem is that the spaces between the colon and the value are getting
broken apart. But if you quote "$field1" and "$field2" in the formail
command, then you'll get null parameters when they are empty, and formail
won't like that either. So let's dig in.
field1 field2
:0
* flag1 ?? yes
{ field1 = "-A 'X-header1: value'" }
:0
* flag2 ?? yes
{ field2 = "-A 'X-header2: value'" }
# Call formail only once with all headers known
:0fh
| formail -A "X-my: required" $field1 $field2