||6th April 2011 10:56
Triggering a script when mail is received on some address in ISPConfig3
Well, i started this post to ask for your assistance .. but while i was typing, and double checking everything i resolved the problem.
Instead of closing this window and go on with my day i thought it might be useful to post my solution so others can benefit from it in case they run into the same problem (i couldn't find anything on the forum btw)
Anyway, i wanted to trigger a script when i received an email on a specified address (email@example.com).
The problem i ran into here was that, postfix didn't knew "firstname.lastname@example.org", so i got this error:
Apr 6 09:42:55 domain-mail postfix/smtpd: NOQUEUE: reject: RCPT from mail.mydomain.tld[188.8.131.52]: 550 5.1.1 <email@example.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<firstname.lastname@example.org> to=<email@example.com> proto=ESMTP helo=<mail.mydomain.tld>
Oke, well let's make a virtual user (bounce@ should not be a real mailbox)
So in ISPConfig3 i added a "Mail forward"
E-Mail: bounce @ domain.tld
Destination Email: bounce
By not adding a domain after "bounce" this will become a local user on this system, hence it will be picked up by "aliasses" (where we said: run script X when mail for bounce).
Apr 6 09:16:05 domain-mail amavis: (21988-08) Passed CLEAN, [184.108.40.206] [220.127.116.11] <firstname.lastname@example.org> -> <email@example.com>, Message-ID: <4D9C1310.firstname.lastname@example.org>, mail_id: ZbitfjKRIENQ, Hits: -0.001, size: 1359, queued_as: 48A52819C7, 2170 ms
Apr 6 09:16:05 domain-mail postfix/smtp: 1C8EB819C6: to=<email@example.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=2.3, delays=0.14/0.01/0/2.2, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=21988-08, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 48A52819C7)
Apr 6 09:16:05 domain-mail postfix/smtp: 48A52819C7: to=<firstname.lastname@example.org>, orig_to=<email@example.com>, relay=none, delay=0.07, delays=0.07/0/0/0, dsn=5.4.6, status=bounced (mail for mail.domain.tld loops back to myself)
mail.domain.tld is indeed the same machine, so we need to tell postfix that he is mail.domain.tld as destination so add "mail.domain.tld" to "mydestination" in /etc/postfix/main.cf
mydestination = domain-mail.domain.tld, localhost, localhost.localdomain mail.domain.tld
Apr 6 09:57:35 domain-mail postfix/local: 60BBD819D0: to=<firstname.lastname@example.org>, orig_to=<email@example.com>, relay=local, delay=568, delays=568/0/0/0.04, dsn=2.0.0, status=sent (delivered to command: /data/scripts/processbounce.sh)
P.S. Adding a virtual alias map didn't work. And now we keep using ispconfig's interface, which imho is more neat.
|All times are GMT +2. The time now is 11:16.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.