1

Topic: Iredmail hooks / notifications on mail reception

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.6.9
- Linux/BSD distribution name and version: Ubuntu
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx):None
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====

Is there any predefined hook or way to develop a custom hook to send a notification (mail data) from Iredmail to a Java project on mail reception ?

Thanks in advance.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Iredmail hooks / notifications on mail reception

Check this tutorial:
http://www.iredmail.org/docs/pipe.incom … cript.html

3

Re: Iredmail hooks / notifications on mail reception

We tried to run a Shell Script containing "echo 'msg'".
After running the following SQL command we were not able to send e-mails anymore and no results were displayed :

UPDATE mailbox SET transport='external-pipe' WHERE username='user@domain.ltd';

Then, What's wrong ? What should we include in our Shell script to make it work perfectly ?

4

Re: Iredmail hooks / notifications on mail reception

Debug your script ...

Note: full email messages was piped to your script as stdin. like this:

bash script.sh < /path/to/file

5 (edited by mohamedmaalej.sde 2017-04-17 22:02:37)

Re: Iredmail hooks / notifications on mail reception

When I followed  the tutorial you sent to me earlier and tried to send an email, it said : "Is there any server running on port 5432 on host 127.0.0.1 ?" . When I start the local postgresql service (on Iredmail Docker container), it said 'FATAL:  password authentication failed for user "vmail" '.

P.S: The Postgresql containing all mailing data (iredapd,vmail,amavisd) is located on an isolated container. I am running iredmail on another container as well. Why is it looking locally for the database when using the hooks ??

When I tried to shutdown local postgres (installed on the iredmail container), it said (on /var/log/iredapd/iredapd.log):
"2017-04-17 13:27:27 ERROR Unexpected error: (OperationalError) could not connect to server: Connection refused
        Is the server running on host "127.0.0.1" and accepting
        TCP/IP connections on port 5432?"

Please advise.

6 (edited by benmansour.anass 2017-04-21 16:11:58)

Re: Iredmail hooks / notifications on mail reception

Hi,

I have the same isssue, have you found a solution  ?
Is it possible to configure iredmail to use the external database with hooks ?
Please help me, I'm stuck

Thanks

7 (edited by jackavin 2017-04-21 22:13:35)

Re: Iredmail hooks / notifications on mail reception

Maybe quarantine all clean email to amavis database.
then use it to another program.

at /etc/amavis/conf.d/50-user

8

Re: Iredmail hooks / notifications on mail reception

jackavin wrote:

Maybe quarantine all clean email to amavis database.
then use it to another program.

at /etc/amavis/conf.d/50-user

Re: Iredmail hooks / notifications on mail reception

Thanks for your reply but my problem is not how to retrieve incoming mails. It's about executing a shell script on mail receipt.
When I used Postfix hooks, Postfix was pointing to localhost when the call occurred. When I sent mails without hooks configuration, the postfix  is pointing to the external postgresql database.

What's wrong with the hooks ? Why are they looking  locally (local postgres database) instead of the external  postgresql ?