Postfix - Passing email to a script
David Fletcher
dave at thefletchers.net
Fri Jan 29 18:58:29 UTC 2021
Hi all,
I'm developing a solution for distributing GPX route files to those who
want to use them on smartphones instead of paper printed directions for
navigating suggested routes with a classic car club. My idea is to give
to anybody who wants the GPX file an email address which will trigger
my mail server to send a reply with the GPX file attached.
At the moment I have working from the aliases file:-
emailexperiments: "|/home/emailexperiments/autoreplytesting"
which calls the script
#!/bin/bash
read header
fromaddr=$(echo $header | cut -d' ' -f 2)
sendEmail \
-q\
-f noreply at thefletchers.net\
-t $fromaddr\
-u "Autoreply testing"\
-m Autoreply from server
Put together from results of various Google searches. This appears to
be working so far, tested by me from my own server and a friend using
gmail. All I then need to do is add the attachment to the sendEmail
call.
The read command appears (IANAE) to fetch the next line from the email
with each call. So far that first line contains
>From address at example.com etc etc
BUT my question is, will it ALWAYS be the first line that contains the
sender's address or do I need to use a loop to make certain I always
find it?
Thanks as always to all those who know and understand more than I do!
Dave
More information about the ubuntu-users
mailing list