Skip to content

Instantly share code, notes, and snippets.

@tpraxl

tpraxl/.qmail-test

Created Jun 7, 2018
Embed
What would you like to do?
Autorespond using IMAP on Uberspace 7 (U7)
|maildrop $HOME/.test-filter
############################################
# Autorespond using IMAP on Uberspace 7 (U7)
############################################
# Date: 2018-06-07
# Abstract:
# This script allows you to enable the autoresponder by creating an IMAP folder
# called "Autorespond" in the root of your IMAP folders (not in INBOX, but as
# a sibling of INBOX).
#
# Once the folder is present and it contains a message, the autoresponder is
# turned on and it will respond with the most recent message in this
# folder.
#
# Limitations:
# Notice that I couldn't find a way to turn off quoting of the original message.
#
# How-to:
# In the following script, we assume that you have created a mail user test:
#
# uberspace mail user add test
#
# Just replace "test" with your desired mail user name in this script.
#
# We also assume that your E-Mail-Adress is test@stardust.uber.space
# Just replace stardust with your host's name (e.g. klemola, taylor, etc),
# don't confuse it with the name of your Uberspace
# (the one, you have chosen yourself).
#
# If you are using an external domain, this will work as well. E.g. for
# test@mydomain.tld. You can specify test@mydomain.tld as the sender below as well.
#
# You should create one filter file for each autoresponder
# sender email address separately.
#
# Make sure that each filter file has access rights 600, otherwise it won't work:
# chmod 600 .test-filter
#
# Make sure that you use UNIX line-endings in this file, otherwise it won't work.
#
# Create the file .qmail-test with the following content (including the pipe):
# |maildrop $HOME/.test-filter
#
# If you want to debug the autoresponder, turn on logging
# by uncommenting the following line.
#
# logfile "$HOME/test-filter.log"
# Set the default Maildir
MAILDIR="$HOME/Maildir"
# Set the sender for the autoresponse
FROM="test@stardust.uber.space"
# If you're using a separate mail user (not the primary), we setup the MAILDIR
# accordingly
import EXT
if ( $EXT )
{
CHECKMAILDIR = `dumpvuser $EXT | grep '^Directory' | awk '{ print $2 }'`
if ( $CHECKMAILDIR )
{
MAILDIR="$HOME/$CHECKMAILDIR"
}
}
# Autoresponder rule
#
# Note: -N is useless when using -T replydraft. I couldn't find a way to disable
# quoting when using this reply format. Suggestions are welcome.
# See http://www.courier-mta.org/maildrop/mailbot.html
cc "| mailbot -T replydraft -l '$MAILDIR/.Autorespond' -N -A 'From: $FROM' /var/qmail/bin/qmail-inject -f ''"
# Receive the mail (the original mail goes into your INBOX)
to "$MAILDIR"
@tpraxl

This comment has been minimized.

Copy link
Owner Author

@tpraxl tpraxl commented Jun 7, 2018

Your Webmail Autorespond folder should look like this

autoresponder-imap-uberspace-7

@mxmehl

This comment has been minimized.

Copy link

@mxmehl mxmehl commented Oct 11, 2018

Thanks, I was looking for a solution since qmail-autorespond isn't existent on U7 any more.

However, does your script cleverly exclude mails from mailing lists like qmail-autoresponder does, or does it reply to simply everything?

@the-amazing-horst

This comment has been minimized.

Copy link

@the-amazing-horst the-amazing-horst commented Jan 23, 2020

You can skip the -T replydraft -l '$MAILDIR/.Autorespond' part and write -t $HOME/autoresponders/response.txt -N instead.
The only thing you have to do is creating the directory autoresponders or whatever you prefer to name it. And the response.txt file of course.

@tpraxl

This comment has been minimized.

Copy link
Owner Author

@tpraxl tpraxl commented Jan 23, 2020

Thanks for your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment