Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
mbox processing now works properly
Browse files Browse the repository at this point in the history
  • Loading branch information
sbisbee committed Feb 13, 2010
1 parent 7d1e8db commit 8078fd0
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions mailp.bsh
Expand Up @@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from='noreply@example.com'
to='dade@example.com'
mbox='./mbox'
from='noreply@computervip.com'
to='sbisbee@computervip.com'
mbox='/home/sbisbee/Mail/mbox'

pendingFile='/tmp/mailp-pending'

Expand All @@ -31,13 +31,7 @@ working. Once done, this e-mail will be deleted automatically.
--
Your friendly mailp script" | mail -s "mailp test" --append="X-MAILP: $key" --append="From: $from" $to

if [[ $? -eq 0 ]]
then
echo "Mail sent"
else
echo "Mail was not sent successfuly"
exit 1
fi
[[ $? -ne 0 ]] && { echo "Mail was not sent successfuly"; exit 1; }

echo "$to $key" >> "$pendingFile"
}
Expand All @@ -47,7 +41,9 @@ processPending()
while read email key
do
lockBox
./deleteMessage.plx "$mbox" "x-mailp" "$key" "$email" > "$mbox.out"
tmpMbox=`mktemp`
./deleteMessage.plx "$mbox" "x-mailp" "$key" "to" ".*$email.*" > "$tmpMbox" || { echo "Error: failed to process the mbox"; exit 1; }
mv "$tmpMbox" "$mbox"
unlockBox
sed -i -e "/$key/d" "$pendingFile"
done < "$pendingFile"
Expand All @@ -57,7 +53,7 @@ lockBox()
{
if [[ `which mutt_dotlock` ]]
then
mutt_dotlock "$mbox" || { echo "Error: couldn't get a lock on the mbox."; exit 1; }
mutt_dotlock "$mbox" || { echo "Error: couldn't get a lock on the mbox with mutt_dotlock."; exit 1; }
else
# Doesn't look like there's a native lock system, so we use our own
# primitive one.
Expand Down

0 comments on commit 8078fd0

Please sign in to comment.