Collecting MessagesTopMailingNotification

Notification

Sending notifications

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 subject carries the message thread identifier.

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.

~im2000/.qmail-eb
 
Note
that this file overrides the debug-implementation of .qmail-eb in the "Posting" document.
More important note:
this has changed to fit better with the collecting function. find the actual version at the bottom, I do not want to make the whole mess with the comments again. The change is in the Subject: field, it now carries the whole access path of the message in im2000's home directory.
# 1) do security checks

# 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`"

Actual dot-qmail-eb
 
# first generate the notify message and send it

| 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`"

Receiving notifications

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:

~im2000/.qmail-notify
 
# 1) security stuff

# 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##* }`"

Notes:
 

Jorge.Lehner@gmx.net

Collecting MessagesTopMailingNotification