#!/bin/bash USERNAME="$1" [ -z "$USERNAME" ] && echo "Usage : $0 [username]" && exit 1 for id in $( username_to_original_mailid "$USERNAME" ) do for f in $( grep -r -l "$id" /var/spool/postfix/deferred/ ) do basename "$f" done done