Timothy Ha wrote:
Sorry my stupid question today. I have used maildrop in command line
with some email, and found that my domains, being routed through a
Mysql table, used virtual: as their method, not maildrop:
Now after I changed a test domain to maildrop:, maildrop started
working. But I need some help with maildroprc scripting.
Postfix master.cf contains
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop /etc/maildroprc -d
${recipient}
So when email arrives at /etc/maildroprc, RECIPIENT is set to
us...@domain.com
How can I split it to make Maildir become
/home/vmail/domain.com/u/user (this is how my vmail system is doing),
or at least /home/vmail/domain.com/user ?
if (${RECIPIENT} =~ /(\S+)@(\S+)/)
{
user=${MATCH1}
domain=${MATCH2}
}
else
{
user="$RECIPIENT"
domain="
}
be careful if you allow spaces or "weired" characters in email
addresses. because I see you running an mkdir or maildirmake using these
variables, but you don't want to do 'mkdir /home/vmail/foo; rm -rf
/home/vmail'.
better put the mailbox location in mysql instead.
I am a newbie in bash scripting...
bash? this is maildrop, not bash.
Thanks.
This is the piece that I need to change:
-------------------------------------------------
VHOME="/home/vmail"
RECIPIENT=tolower("$1")
USER=tolower("$2")
HOST=tolower("$3")
SENDER=tolower("$4")
HOME=tolower("$5")
you are not using any $* in your master.cf (except /etc/maildroprc which
should be removed).