1

Topic: SMTP Problem

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

Hello,

I am using Interspire Email Marketer with iRedmail.

I tried to configure the SMTP settings in the Interspire Email Marketer, for sending out emails. I have used the following settings:

   SMTP Hostname:     mail.mydomain.com
   SMTP Username:     admin@mydomain.com
   SMTP Password:     mypassword
   SMTP Port : 587

When I Test the SMTP settings, I got the following error :

Email Marketer says:
"A test email has not been successfully sent. 530 5.7.0 Must issue a STARTTLS command first".

# cat /var/log/mail.log  shows:
Sep  2 07:33:47 server postfix/smtpd[2759]: connect from unknown[67.11.22.33]
Sep  2 07:33:47 server postfix/smtpd[2759]: disconnect from unknown[67.11.22.33]

From the above message, it looks like the Interspire Email Marketer doesn't support STARTTLS. So I did the method in the following url to enable smtps: http://www.iredmail.org/docs/enable.smtps.html
Then I tried to send email using SMTP Port : 465, and I got the following error:

Interspire Email Marketer says:
A test email has not been successfully sent

# cat /var/log/mail.log  shows:
Sep  2 07:38:06 server postfix/smtpd[2821]: connect from unknown[67.11.22.33]
Sep  2 07:39:06 server postfix/smtpd[2821]: SSL_accept error from unknown[67.11.22.33]: lost connection
Sep  2 07:39:06 server postfix/smtpd[2821]: lost connection after CONNECT from unknown[67.11.22.33]
Sep  2 07:39:06 server postfix/smtpd[2821]: disconnect from unknown[67.11.22.33]

Could you please help me to make an SMTP connection successfully ? Thanks.

----

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

2

Re: SMTP Problem

Make sure your Marketer software has STARTTLS support enabled for smtp service. I suggest you contact Marketer software to get support.

3

Re: SMTP Problem

ZhangHuangbin wrote:

Make sure your Marketer software has STARTTLS support enabled for smtp service. I suggest you contact Marketer software to get support.

Zhang,

I have contacted the IEM support. From their reply, it seems the Email Marketer doesn't have the STARTTLS support. So what can I do ?

I have the following questions in my mind:

1. Is there any work around, which can be done on the MailServer side, to make all the SMTP Connections (or only the SMTP Connections from the Email Marketer) use STARTTLS by default ?

2. The IEM has only the following Email Settings:
   SMTP Hostname:
   SMTP Username:
   SMTP Password:
   SMTP Port :

Is there any method other than STARTTLS, so that I can make an SMTP connection ?

Please help. Thanks.

4

Re: SMTP Problem

Try to add lines below in /etc/postfix/master.cf to ask Postfix to listen on additional port (2225 in this sample) for smtp service:

127.0.0.1:2225 inet n  -   -   -   -  smtpd
  -o smtpd_tls_security_level=may
  -o smtpd_sasl_auth_enable=yes

Then update IEM to use port 2225 (with smtp username/password).

Notes:

*) if your IEM is running on another host, you should replace '127.0.0.1' by the public IP address which is accessible from IEM host.

*) You'd better update firewall to allow connection to this port from ONLY IEM host.

5

Re: SMTP Problem

Zhang,

The iRedmail and the IEM is running on the same machine.

I have added the the above settings to /etc/postfix/master.cf, restarted the postfix service, updated the iptables to ACCEPT port 2225 and tried and SMTP connection from the IEM. But it gives the following error now:

"
A test email has not been successfully sent: Unable to connect to mail server: Connection refused(111)
"

There are no corresponding logs appear in /var/log/mail.log. I have tried even after stopping the iptables. But nothing is coming in  /var/log/mail.log.

You can have a look at my master.cf

#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#smtp      inet  n       -       -       -       1       postscreen
#smtpd     pass  -       -       -       -       -       smtpd
#dnsblog   unix  -       -       -       -       0       dnsblog
#tlsproxy  unix  -       -       -       -       0       tlsproxy
#submission inet n       -       -       -       -       smtpd
#  -o syslog_name=postfix/submission
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       -       -       -       smtpd
#  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       -       -       -       qmqpd
pickup    unix  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix    -    n    n    -    2    pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

submission inet n       -       n       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
#  -o content_filter=smtp-amavis:[127.0.0.1]:10026

# Use dovecot deliver program as LDA.
dovecot unix    -       n       n       -       -      pipe
    flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${domain} -m ${extension}

smtp-amavis unix -  -   -   -   10  smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20

127.0.0.1:10025 inet n  -   -   -   -  smtpd
    -o content_filter=
    -o mynetworks_style=host
    -o mynetworks=127.0.0.0/8
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o strict_rfc821_envelopes=yes
    -o smtp_tls_security_level=none
    -o smtpd_tls_security_level=none
    -o smtpd_restriction_classes=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_end_of_data_restrictions=
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o smtpd_client_connection_count_limit=0
    -o smtpd_client_connection_rate_limit=0
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings

127.0.0.1:2225 inet n  -   -   -   -  smtpd
    -o smtpd_tls_security_level=may
    -o smtpd_sasl_auth_enable=yes

6

Re: SMTP Problem

*) master.cf looks fine.
*) After restarted postfix service, can you see service '127.0.0.1:2225' in output of command "netstat -ntlp"?
*) What's the setting in your IEM? smtp server address should be 127.0.0.1, port should be 2225.

7

Re: SMTP Problem

ZhangHuangbin wrote:

*) After restarted postfix service, can you see service '127.0.0.1:2225' in output of command "netstat -ntlp"?

Yes it is appearing in netstat.

ZhangHuangbin wrote:

*) What's the setting in your IEM? smtp server address should be 127.0.0.1, port should be 2225.

That fixed the problem. I have changed the SMTP Hostname from 'mail.mydomain.com' to 127.0.0.1 in the IEM and it started working. Thanks a lot for your great support. I still wonder why I was not able to use mail.mydomain.com as the  SMTP Hostname though.

ZhangHuangbin wrote:

*) You'd better update firewall to allow connection to this port from ONLY IEM host.

I have added the following to /etc/default/iptables under 'smtp submission' and restarted the iptables service now.

-A INPUT -p tcp --dport 2225 -j ACCEPT

How can I allow the connection to 2225 only from IEM host ? What is the idea ?

Thanks.

8

Re: SMTP Problem

If you have IEM running on same server, no need to update iptables rules.

9

Re: SMTP Problem

okay, those problems are solved now.

Could you please recommend the POP3 settings that I have to use in the IEM, based on the current iRedmail installation ? This POP3 / IMAP settings will be used for the Bounce Processing. I am using the following settings now.

http://snag.gy/OxRch.jpg

10

Re: SMTP Problem

Please try it yourself first. If it doesn't work, paste related error message here, or ask support from IEM.