Notification |
In Qim2000 a notification is issued, whenever a message block es finished. There is no caching, queuing or forhand notification done.
As actually there is only one message per thread to be expected, and one recipient per message, ".qmail-eb" simply extracts the X-im2000-recipient-identifier: and -sender-identifier field and forwards a message to that address. However, to guarantee re-spooling into the Qim2000 system, the domain part of the notify message is changed to be im2000.recipient_domain.
The notification message is composed of the following aditional headers:
The body of the notify message is not used by the Qim2000 transport, to allow adition of checksums, signatures, keys, etc. by other layers.
A copy of the notification message is stored in the Maildir of the message thread, along with the messages in a file with the same name of the message id with ":4,secuence.n" appended, where n is the count of the notification intent, which in our case is always one (1). Note that this is an arbitrary extension of Dan Bersteins usage instruction about the names of files in Maildirs.
# 2) find out the message identifier
# | THREAD=$(/usr/local/bin/822field) \
# MESSID=$(ls $THREAD/new/*:3,* | head -1) \
# 3) create the recipient address
# MAILTO=$(/usr/local/bin/822field X-im2000-recipient-identifier: \
# < "$MESSID") \
# 4) add the message identifer field \
# /usr/local/bin/822header < "$MESSID" \
# | /usr/bin/reformail -a `"X-im2000-message-identifier: ${MESSID##*/}`" \
# 5) send the notification \
# | /var/qmail/bin/forward ${MAILTO%%@*}@im2000.${MAILTO##*@} \
| THREAD=$(/usr/local/bin/822field) \
; MESSID=$(ls $THREAD/new/*:3,* | head -1) \
; MAILTO=$(/usr/local/bin/822field X-im2000-recipient-identifier: \
< `"$MESSID`") \
; /usr/local/bin/822header < `"$MESSID`" \
| /usr/bin/reformail -a `"X-im2000-message-identifier: ${MESSID##*/}`" \
| /var/qmail/bin/forward ${MAILTO%%@*}@im2000.${MAILTO##*@} \
# Now to the whole story again, but store it along with the mail.
| THREAD=$(/usr/local/bin/822field) \
; MESSID=$(ls $THREAD/new/*:3,* | head -1) \
; MAILTO=$(/usr/local/bin/822field X-im2000-recipient-identifier: \
< `"$MESSID`") \
; /usr/local/bin/822header < `"$MESSID`" \
| /usr/bin/reformail -a `"X-im2000-message-identifier: ${MESSID##*/}`" \
> `"${MESSID%%:3,*}:4,${MESSID##*:3,}-1`"
| THREAD=$(/usr/local/bin/822field) \
; MESSID=$(/bin/ls $THREAD/new/*:3,* | head -1) \
; MAILTO=$(/usr/local/bin/822field X-im2000-recipient-identifier: \
< `"$MESSID`") \
; /usr/local/bin/822header < `"$MESSID`" \
| /usr/bin/reformail -a `"X-im2000-message-identifier: ${MESSID##*/}`" \
| /usr/bin/reformail -I `"From: im2000-cl@$(cat /var/qmail/control/me)`" \
-i `"Subject: $MESSID`" \
| /var/qmail/bin/forward ${MAILTO%%@*}@im2000.${MAILTO##*@} \
# store the notification locally
| THREAD=$(/usr/local/bin/822field) \
; MESSID=$(/bin/ls $THREAD/new/*:3,* | head -1) \
; MAILTO=$(/usr/local/bin/822field X-im2000-recipient-identifier: \
< `"$MESSID`") \
; /usr/local/bin/822header < `"$MESSID`" \
| /usr/bin/reformail -a `"X-im2000-message-identifier: ${MESSID##*/}`" \
> `"${MESSID%%:3,*}:4,${MESSID##*:3,}-1`"
The receiving Qim2000 server is a Qmail mail-server, configured to receive Email for this virtual domain, and forward it to the im2000-notify user, which can do centralized autentication and validation of the notification message, before (eventually) hand it over to the local user corresponding to the recipient identifer.
The notification get's stored in the notify subdirectory the following way:
# 2) send the notification to the (local) user
# | forward $EXT2
# 3a) save the message
# | NOTIF=$(/usr/local/bin/safecat tmp mail) \
# 3b) create the message thread
# ; THREAD=$(/usr/local/bin/822field < mail/`"$NOTIF`") \
# ; mkdir -p notify/${HOST#*.}/`"${THREAD##* }`" ;
# 3c) get the message identifier
# ; MESSID=$(/usr/local/bin/822field X-im2000-message-identifier \
# < mail/$NOTIF) \
# 4) get the notification in it's place
# ; mv mail/`"$NOTIF`" notify/${HOST#*.}/`"${THREAD##* }/${MESSID##* }`"
| forward $EXT2
| NOTIF=$(/usr/local/bin/safecat tmp mail) \
; THREAD=$(/usr/local/bin/822field < mail/`"$NOTIF`") \
; mkdir -p notify/${HOST#*.}/`"${THREAD##* }`" ;
; MESSID=$(/usr/local/bin/822field X-im2000-message-identifier \
< mail/$NOTIF) \
; mv mail/`"$NOTIF`" notify/${HOST#*.}/`"${THREAD##* }/${MESSID##* }`"
Notification |