summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--femtomail.c9
2 files changed, 12 insertions, 2 deletions
diff --git a/README.md b/README.md
index 69b6366..380d807 100644
--- a/README.md
+++ b/README.md
@@ -37,6 +37,11 @@ be changed to `~/.Maildir/inbox` as follows:
make USERNAME=peter MAILBOX_PATH=.Maildir/inbox
+Absolute paths are also supported. The following configuration will put mail in
+`/var/mail/new/(filename)`:
+
+ make USERNAME=nobody MAILBOX_PATH=/var/mail
+
To install femtomail on your system with the appropriate capabilities:
make install install-link-sendmail setcap
diff --git a/femtomail.c b/femtomail.c
index b07d7a7..2838463 100644
--- a/femtomail.c
+++ b/femtomail.c
@@ -42,7 +42,8 @@
# error Please define the user to deliver mail to with USERNAME
#endif
-/* Maildir directory relative to home dir of USERNAME (see above) */
+/* Maildir; either absolute (starting with a forward slash) or
+ * a directory relative to home dir of USERNAME (see above) */
#ifndef MAILBOX_PATH
# define MAILBOX_PATH ".local/share/local-mail/inbox"
#endif
@@ -67,7 +68,11 @@ init_user(const char *username, char *maildir, size_t maildir_len) {
return 1;
}
- snprintf(maildir, maildir_len, "%s/" MAILBOX_PATH "/new", pwd->pw_dir);
+ if ((MAILBOX_PATH)[0] == '/') {
+ snprintf(maildir, maildir_len, "%s/new", MAILBOX_PATH);
+ } else {
+ snprintf(maildir, maildir_len, "%s/%s/new", pwd->pw_dir, MAILBOX_PATH);
+ }
return 0;
}