1

Topic: Cant' send emails...

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

Hi Zhang, hi all,
i have just install the last version of iredmail in a new server. i cant send emails and here is the erros in /var/log/mail.log (i just change the ip address and domain name)

Feb 22 05:27:01 mail postfix/submission/smtpd[2472]: Anonymous TLS connection established from localhost[127.0.0.1]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Feb 22 05:27:01 mail postfix/trivial-rewrite[2474]: warning: do not list domain mydomain.tld in BOTH mydestination and virtual_mailbox_domains
Feb 22 05:27:01 mail postfix/submission/smtpd[2472]: warning: connect to 127.0.0.1:7777: Connection refused
Feb 22 05:27:01 mail postfix/submission/smtpd[2472]: warning: problem talking to server 127.0.0.1:7777: Connection refused
Feb 22 05:27:02 mail postfix/submission/smtpd[2472]: warning: connect to 127.0.0.1:7777: Connection refused
Feb 22 05:27:02 mail postfix/submission/smtpd[2472]: warning: problem talking to server 127.0.0.1:7777: Connection refused
Feb 22 05:27:02 mail postfix/submission/smtpd[2472]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 451 4.3.5 Server configuration problem; from=<postmaster@mydomain.tld> to=<postmaster@mydomain.tld> proto=ESMTP helo=<192.168.1.5>
Feb 22 05:27:02 mail roundcube: ERROR: Invalid response code received from server (451)
Feb 22 05:27:02 mail roundcube: <rbnnhmr6> SMTP Error: Failed to add recipient 'postmaster@mydomain.tld'. 4.3.5 Server configuration problem (Code: 451) in /opt/www/roundcubemail-1.2.3/program/lib/Roundcube/rcube.php on line 1648 (POST /mail/?_task=mail&_unlock=loading1487759221666&_lang=fr_FR&_framed=1&_action=send)
Feb 22 05:27:02 mail postfix/submission/smtpd[2472]: disconnect from localhost[127.0.0.1]

Thank's for u're help

----

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

2

Re: Cant' send emails...

lesly wrote:

Feb 22 05:27:01 mail postfix/trivial-rewrite[2474]: warning: do not list domain mydomain.tld in BOTH mydestination and virtual_mailbox_domains

Fix this one by following our tutorial below:
http://www.iredmail.org/docs/errors.htm … ox_domains

lesly wrote:

Feb 22 05:27:01 mail postfix/submission/smtpd[2472]: warning: connect to 127.0.0.1:7777: Connection refused

iRedAPD service is not running. Please start it first.

3

Re: Cant' send emails...

Hi ,
Thank's for the quick reply.

I dont found the service iRedAPD  in /etc/init.d to start it. Where is the location of this service?

i have change mydestination then the first warning is not display but still have the others warning:
postfix/submission/smtpd[2472]: warning: connect to 127.0.0.1:7777: Connection refused
mail postfix/submission/smtpd[2472]: warning: problem talking to server 127.0.0.1:7777: Connection refused
mail postfix/submission/smtpd[2472]: warning: connect to 127.0.0.1:7777: Connection refused

Thank's again for helping me.

ZhangHuangbin wrote:
lesly wrote:

Feb 22 05:27:01 mail postfix/trivial-rewrite[2474]: warning: do not list domain mydomain.tld in BOTH mydestination and virtual_mailbox_domains

Fix this one by following our tutorial below:
http://www.iredmail.org/docs/errors.htm … ox_domains

lesly wrote:

Feb 22 05:27:01 mail postfix/submission/smtpd[2472]: warning: connect to 127.0.0.1:7777: Connection refused

iRedAPD service is not running. Please start it first.

4

Re: Cant' send emails...

Hi Zhang;

I solved the problem by doing this:

cp /opt/iredapd/rc_scripts/iredapd.debian /etc/init.d/iredapd

chmod +x /etc/init.d/iredapd

/etc/init.d/iredapd restart

hopes no any another problem :-)

thank's again

5

Re: Cant' send emails...

On Debian 8, there's no /etc/init.d/iredapd, we use systemd instead. You can find it here:
/etc/systemd/system/multi-user.target.wants/iredapd.service. and it's actually a symbol link to /opt/iredapd/rc_scripts/iredapd.service.

6 (edited by lesly 2017-02-23 16:20:47)

Re: Cant' send emails...

Hi Zhang,

How to start this service ?

systemctl start iredapd.service  dont works

systemctl is-active iredapd.service : failed...

And:
systemctl status iredapd.service

● iredapd.service - iRedAPD (A simple posfix policy server)
   Loaded: loaded (/opt/iredapd/rc_scripts/iredapd.service)
   Active: failed (Result: exit-code) since Thu 2017-02-23 03:18:56 EST; 23s ago
  Process: 10197 ExecStart=/usr/bin/python /opt/iredapd/iredapd.py (code=exited, status=226/NAMESPACE)

Feb 23 03:18:56 mail  systemd[1]: iredapd.service: control process exited, code=exited status=226
Feb 23 03:18:56 mail systemd[1]: Failed to start iRedAPD (A simple posfix policy server).
Feb 23 03:18:56 mail systemd[1]: Unit iredapd.service entered failed state.

ZhangHuangbin wrote:

On Debian 8, there's no /etc/init.d/iredapd, we use systemd instead. You can find it here:
/etc/systemd/system/multi-user.target.wants/iredapd.service. and it's actually a symbol link to /opt/iredapd/rc_scripts/iredapd.service.

Thank's again for help

7

Re: Cant' send emails...

Run "service iredapd restart". Did you see any error on console or in /var/log/iredapd/iredapd.log?

8

Re: Cant' send emails...

Hi  Zhang,

service iredapd restart

Job for iredapd.service failed. See 'systemctl status iredapd.service' and 'journalctl -xn' for details.

And in /var/log/syslog :

systemd[1]: Starting iRedAPD (A simple posfix policy server)...
systemd[1]: Failed to reset devices.list on /system.slice/iredapd.service: Operation not permitted
systemd[25757]: Failed at step NAMESPACE spawning /usr/bin/python: Permission denied
systemd[1]: iredapd.service: control process exited, code=exited status=226
systemd[1]: Failed to start iRedAPD (A simple posfix policy server).
systemd[1]: Unit iredapd.service entered failed state.

Thank's again for the help

9

Re: Cant' send emails...

lesly wrote:

systemd[25757]: Failed at step NAMESPACE spawning /usr/bin/python: Permission denied

Please show us output of command:

ls -l /usr/bin/python

10

Re: Cant' send emails...

Hi Zhang;
ls -l /usr/bin/python

lrwxrwxrwx 1 root root 9 Mar 16  2015 /usr/bin/python -> python2.7

Thank's for help

11

Re: Cant' send emails...

The permission is fine. What's the output of command below?

/usr/bin/python /opt/iredapd/iredapd.py

12

Re: Cant' send emails...

ZhangHuangbin wrote:

The permission is fine. What's the output of command below?

/usr/bin/python /opt/iredapd/iredapd.py

Hi Zhang,

/usr/bin/python /opt/iredapd/iredapd.py

Traceback (most recent call last):
  File "/opt/iredapd/iredapd.py", line 265, in <module>
    main()
  File "/opt/iredapd/iredapd.py", line 216, in main
    DaemonSocket(local_addr, db_conns)
  File "/opt/iredapd/iredapd.py", line 169, in __init__
    self.bind(local_addr)
  File "/usr/lib/python2.7/asyncore.py", line 342, in bind
    return self.socket.bind(addr)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use

Thank's for help

13

Re: Cant' send emails...

Strange, Postfix says iredapd is not running, but running it manually says is running. Please try command below to see which program is listening on port 7777:

lsof -i :7777

14

Re: Cant' send emails...

ZhangHuangbin wrote:

Strange, Postfix says iredapd is not running, but running it manually says is running. Please try command below to see which program is listening on port 7777:

lsof -i :7777

Hi,

lsof -i :7777

COMMAND PID    USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME

python  537 iredapd    3u  IPv4 14300206      0t0  TCP localhost:7777 (LISTEN)

15

Re: Cant' send emails...

Hi,
I have just reinstall iredmail on fresh server debian.
Here is a summary of the commands:

1- systemctl start iredapd.service

Job for iredapd.service failed. See 'systemctl status iredapd.service' and 'journalctl -xn' for details.

2- systemctl status iredapd.service

● iredapd.service - iRedAPD (A simple posfix policy server)
   Loaded: loaded (/opt/iredapd/rc_scripts/iredapd.service)
   Active: failed (Result: exit-code) since Mon 2017-02-27 13:05:22 EST; 40s ago
  Process: 1871 ExecStart=/usr/bin/python /opt/iredapd/iredapd.py (code=exited, status=226/NAMESPACE)

Feb 27 13:05:22 test-mail systemd[1871]: Failed at step NAMESPACE spawning /usr/bin/python: Permission denied
Feb 27 13:05:22 test-mail systemd[1]: iredapd.service: control process exited, code=exited status=226
Feb 27 13:05:22 test-mail systemd[1]: Failed to kill control group: Invalid argument
Feb 27 13:05:22 test-mail systemd[1]: Failed to kill control group: Invalid argument
Feb 27 13:05:22 test-mail systemd[1]: Failed to start iRedAPD (A simple posfix policy server).
Feb 27 13:05:22 test-mail systemd[1]: Unit iredapd.service entered failed state.

3- service iredapd restart

Job for iredapd.service failed. See 'systemctl status iredapd.service' and 'journalctl -xn' for details.

4-ls -l /usr/bin/python

lrwxrwxrwx 1 root root 9 Mar 16  2015 /usr/bin/python -> python2.

5- /usr/bin/python /opt/iredapd/iredapd.py

Traceback (most recent call last):
  File "/opt/iredapd/iredapd.py", line 265, in <module>
    main()
  File "/opt/iredapd/iredapd.py", line 216, in main
    DaemonSocket(local_addr, db_conns)
  File "/opt/iredapd/iredapd.py", line 169, in __init__
    self.bind(local_addr)
  File "/usr/lib/python2.7/asyncore.py", line 342, in bind
    return self.socket.bind(addr)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use

6- lsof -i :7777

COMMAND  PID    USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
python  1747 iredapd    4u  IPv4 16075286      0t0  TCP localhost:7777 (LISTEN)
python  1747 iredapd    5u  IPv4 16086994      0t0  TCP localhost:7777->localhost:39090 (ESTABLISHED)
smtpd   2005 postfix   20u  IPv4 16087192      0t0  TCP localhost:39090->localhost:7777 (ESTABLISHED)

And i can send emails..... but when i reboot the machine  i cant send emails --> when i execute this command again

/usr/bin/python /opt/iredapd/iredapd.py --> i can send email...

What's wrong  with the script?

16

Re: Cant' send emails...

lesly wrote:

6- lsof -i :7777
COMMAND  PID    USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
python  1747 iredapd    4u  IPv4 16075286      0t0  TCP localhost:7777 (LISTEN)
python  1747 iredapd    5u  IPv4 16086994      0t0  TCP localhost:7777->localhost:39090 (ESTABLISHED)

Another iRedAPD instance is running and listening on port 7777. So you don't need to start iredapd service manually.

Please make sure iredapd service will be started during system starting up:

systemctl enable iredapd

17

Re: Cant' send emails...

ZhangHuangbin wrote:
lesly wrote:

6- lsof -i :7777
COMMAND  PID    USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
python  1747 iredapd    4u  IPv4 16075286      0t0  TCP localhost:7777 (LISTEN)
python  1747 iredapd    5u  IPv4 16086994      0t0  TCP localhost:7777->localhost:39090 (ESTABLISHED)

Another iRedAPD instance is running and listening on port 7777. So you don't need to start iredapd service manually.

Please make sure iredapd service will be started during system starting up:

systemctl enable iredapd

Hi;

systemctl enable iredapd

Failed to execute operation: No such file or directory

And:
systemctl status iredapd

iredapd.service - iRedAPD (A simple posfix policy server)
   Loaded: loaded (/opt/iredapd/rc_scripts/iredapd.service)
   Active: failed (Result: exit-code) since Tue 2017-02-28 04:25:26 EST; 4min 13s ago
  Process: 451 ExecStart=/usr/bin/python /opt/iredapd/iredapd.py (code=exited, status=226/NAMESPACE)

Failed at step NAMESPACE spawning /usr/bin/python: Permission denied
iredapd.service: control process exited, code=exited status=226
Failed to kill control group: Invalid argument
Failed to kill control group: Invalid argument
Failed to start iRedAPD (A simple posfix policy server).
Unit iredapd.service entered failed state.

Thank's

18

Re: Cant' send emails...

Do you have both /etc/init.d/iredapd and /etc/systemd/system/multi-user.target.wants/iredapd.service? if yes, remove /etc/init.d/iredapd, then try again.

19

Re: Cant' send emails...

ZhangHuangbin wrote:

Do you have both /etc/init.d/iredapd and /etc/systemd/system/multi-user.target.wants/iredapd.service? if yes, remove /etc/init.d/iredapd, then try again.


Hi,
i have just  :
etc/systemd/system/multi-user.target.wants/iredapd.service

Thank's

20

Re: Cant' send emails...

*) Stop iredapd service.

service iredapd stop

*) Check whether there's some process listening on port 7777. If there's one, kill the process with 'kill' command, and re-check.

lsof -i :7777

*) Start iredapd service:

service iredapd start

21

Re: Cant' send emails...

ZhangHuangbin wrote:

*) Stop iredapd service.

service iredapd stop

*) Check whether there's some process listening on port 7777. If there's one, kill the process with 'kill' command, and re-check.

lsof -i :7777

*) Start iredapd service:

service iredapd start

Hi,

*) Stop iredapd service.
service iredapd stop  --> OK

*) Check whether there's some process listening on port 7777. If there's one, kill the process with 'kill' command, and re-check.
lsof -i :7777 ---> OK (no process listening on port 7777)

*) Start iredapd service:
service iredapd start

Job for iredapd.service failed. See 'systemctl status iredapd.service' and 'journalctl -xn' for details.

iredapd not starts....

Thank's

22

Re: Cant' send emails...

I have no idea ... completely lost.
Did you try to restart server?

23

Re: Cant' send emails...

ZhangHuangbin wrote:

I have no idea ... completely lost.
Did you try to restart server?

Hi,
Yes.I have restarted the server several times...
i will keep diging  to found a solution  ....

Thank's :-)