Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 6th April 2011, 10:56
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default 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 (bounce@domain.tld).

so ..

vi /etc/aliases
Code:
bounce: "|/data/scripts/processbounce.sh"
Code:
newaliases
Code:
/etc/init.d/postfix reload
The problem i ran into here was that, postfix didn't knew "bounce@domain.tld", so i got this error:
Quote:
Apr 6 09:42:55 domain-mail postfix/smtpd[23960]: NOQUEUE: reject: RCPT from mail.mydomain.tld[1.2.3.4]: 550 5.1.1 <bounce@domain.tld>: Recipient address rejected: User unknown in virtual mailbox table; from=<mark@mydomain.tld> to=<bounce@domain.tld> 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).

New test!

Quote:
Apr 6 09:16:05 domain-mail amavis[21988]: (21988-08) Passed CLEAN, [1.2.3.4] [5.6.7.8] <mark@mydomain.tld> -> <bounce@domain.tld>, Message-ID: <4D9C1310.1050007@mydomain.tld>, mail_id: ZbitfjKRIENQ, Hits: -0.001, size: 1359, queued_as: 48A52819C7, 2170 ms

Apr 6 09:16:05 domain-mail postfix/smtp[23197]: 1C8EB819C6: to=<bounce@domain.tld>, 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[23158]: 48A52819C7: to=<bounce@mail.domain.tld>, orig_to=<bounce@domain.tld>, 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

Quote:
mydestination = domain-mail.domain.tld, localhost, localhost.localdomain mail.domain.tld
new test!

Quote:
Apr 6 09:57:35 domain-mail postfix/local[24529]: 60BBD819D0: to=<bounce@mail.domain.tld>, orig_to=<bounce@domain.tld>, relay=local, delay=568, delays=568/0/0/0.04, dsn=2.0.0, status=sent (delivered to command: /data/scripts/processbounce.sh)
et voila!

Regards,
Mark

P.S. Adding a virtual alias map didn't work. And now we keep using ispconfig's interface, which imho is more neat.
Reply With Quote
The Following User Says Thank You to Mark_NL For This Useful Post:
falko (7th April 2011)
Sponsored Links
 

Bookmarks

Tags
postfix run script mail

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Catchall and Forwarding not working simmo General 6 22nd March 2014 00:54
Mail server using Postfix, Dovecot, Mysql... Postfix virtual maps doesn't work?? tarasbuljba HOWTO-Related Questions 33 28th May 2010 14:33
ISPconfig 3 some users cannot send email to outside Rockblade Installation/Configuration 7 29th April 2010 01:40
just the last step...and it works. Postfix...need help config. ubuntusr Installation/Configuration 1 5th January 2009 09:50
Mail System Error - Returned Mail tristanlee85 General 16 16th March 2008 09:40


All times are GMT +2. The time now is 15:44.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.