Created
June 7, 2018 11:32
-
-
Save tpraxl/6d5be3527490fb51f33ae5eafe747714 to your computer and use it in GitHub Desktop.
Autorespond using IMAP on Uberspace 7 (U7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|maildrop $HOME/.test-filter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################ | |
# 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 [email protected] | |
# 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 | |
# [email protected]. You can specify [email protected] 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="[email protected]" | |
# 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" |
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?
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.
Thanks for your suggestion.
In case you want to set the FROM header automatically (e.g. if there are multiple users that should be supported by this filter, the FROM address can be constructed as follows:
import EXT
import HOST
FROM="$EXT@$HOST"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your Webmail Autorespond folder should look like this