3

novice trying to use sendmail for the first time. only issue mails never arrive (not even in spam) I have the following logs:

mail.err is empty

mail.log shows accepted for delivery but I also get stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com sometime but not always so not sure if this could this be the issue ?

I already checked that port 25 is open with netstat -tuplen | grep 25

Mail.log:

Feb 17 16:57:16 mysite sendmail[1457]: w1HGvG6p001457:     [email protected], ctladdr=www-data (33/33), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30423, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (w1HGvG8t001458 Message accepted for delivery)

Feb 17 17:00:09 mysite sm-mta[689]: w1HGiDDr003604: to=.   <[email protected]>, ctladdr=<[email protected]> (33/33), delay=00:15:56, xdelay=00:10:01, mailer=esmtp, pri=120652, relay=alt4.gmail-smtp-in.l.google.com. [74.125.28.26], dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.


mqueue file is like this:

V8
T1518886636
K0
N0
P30652
Fbs
$_localhost [127.0.0.1]
$rESMTP
$smysite.com
${daemon_flags}
${if_addr}127.0.0.1
S<[email protected]>
A<>
rRFC822; [email protected]
RPFD:<[email protected]>
H?P?Return-Path: <�g>
H??Received: from mysite.com (localhost [127.0.0.1])
    by mysite.com (8.15.2/8.15.2/Debian-8) with ESMTP id w1HGvG8t001458
    for <[email protected]>; Sat, 17 Feb 2018 16:57:16 GMT
H?x?Full-Name: www-data
H??Received: (from www-data@localhost)
    by bikecomparator.com (8.15.2/8.15.2/Submit) id w1HGvG6p001457;
    Sat, 17 Feb 2018 16:57:16 GMT
H??Date: Sat, 17 Feb 2018 16:57:16 GMT
H??Message-Id: <[email protected]>
H??To: [email protected]
H??Subject: Signup | Verification
H??X-PHP-Originating-Script: 1000:userMgmt.php
H??From:[email protected]

netstat -ntlp | grep sendmail

tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      687/sendmail: MTA:  
tcp        0      0 127.0.0.1:587           0.0.0.0:*               LISTEN      687/sendmail: MTA:  


hosts 127.0.0.1 localhost mysite.com

hotname mysite.com

/etc/mail/sendmail.mc

define(`_USE_ETC_MAIL_')dnl
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
VERSIONID(`$Id: sendmail.mc, v 8.15.2-8 2016-12-08 18:43:49 cowboy Exp $')
OSTYPE(`debian')dnl
DOMAIN(`debian-mta')dnl
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
undefine(`confHOST_STATUS_DIRECTORY')dnl        #DAEMON_HOSTSTATS=
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
dnl #
dnl # General defines
dnl #
dnl # SAFE_FILE_ENV: [undefined] If set, sendmail will do a chroot()
dnl #   into this directory before writing files.
dnl #   If *all* your user accounts are under /home then use that
dnl #   instead - it will prevent any writes outside of /home !
dnl #   define(`confSAFE_FILE_ENV',             `')dnl
dnl #
dnl # Daemon options - restrict to servicing LOCALHOST ONLY !!!
dnl # Remove `, Addr=' clauses to receive from any interface
dnl # If you want to support IPv6, switch the commented/uncommentd  lines
dnl #
FEATURE(`no_default_msa')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MTA-v6, Port=smtp,     Addr=::1')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp,      Addr=127.0.0.1')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, M=Ea, Addr=::1')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, M=Ea,  Addr=127.0.0.1')dnl
dnl #
dnl # Be somewhat anal in what we allow
define(`confPRIVACY_FLAGS',dnl`needmailhelo,needexpnhelo,needvrfyhelo,restrictqrun,restrictexpand,nobodyreturn,authwarnings')dnl
dnl #
dnl # Define connection throttling and window length
define(`confCONNECTION_RATE_THROTTLE', `15')dnl
define(`confCONNECTION_RATE_WINDOW_SIZE',`10m')dnl
dnl #
dnl # Features
dnl #
dnl # use /etc/mail/local-host-names
FEATURE(`use_cw_file')dnl
dnl #
dnl # The access db is the basis for most of sendmail's checking
FEATURE(`access_db', , `skip')dnl
dnl #
dnl # The greet_pause feature stops some automail bots - but check  the
dnl # provided access db for details on excluding localhosts...
FEATURE(`greet_pause', `1000')dnl 1 seconds
dnl #
dnl # Delay_checks allows sender<->recipient checking
FEATURE(`delay_checks', `friend', `n')dnl
dnl #
dnl # If we get too many bad recipients, slow things down...
define(`confBAD_RCPT_THROTTLE',`3')dnl
dnl #
dnl # Stop connections that overflow our concurrent and time connection rates
FEATURE(`conncontrol', `nodelay', `terminate')dnl
FEATURE(`ratecontrol', `nodelay', `terminate')dnl
dnl #
dnl # If you're on a dialup link, you should enable this - so    sendmail
dnl # will not bring up the link (it will queue mail for later)
dnl define(`confCON_EXPENSIVE',`True')dnl
dnl #
dnl # Dialup/LAN connection overrides
dnl #
include(`/etc/mail/m4/dialup.m4')dnl
include(`/etc/mail/m4/provider.m4')dnl
dnl #
dnl # Default Mailer setup
MAILER_DEFINITIONS
MAILER(`local')dnl
MAILER(`smtp')dnl

2 Answers 2

2

You outgoing smtp connection may be blocked by your ISP (as outgoing spamprevention).

Do you get SMTP greeting message when you telnet SMTP port of any gmail.com MXes from the host? [Is it sendmail's fault?]

To get list of gmail MXes use: dig MX gmail.com

To get/check SMTP greeting use: telnet gmail-smtp-in.l.google.com 25

7
  • telnet is stuck at Trying 64.233.167.27... I need to change port ?
    – jotyhista
    Feb 17, 2018 at 18:28
  • You may use tcptraceroute (not simple traceroute) to detect firewall location.
    – AnFi
    Feb 17, 2018 at 18:38
  • ok I didt it and Im only getting traceroute to gmail-smtp-in.l.google.com (64.233.167.27), 30 hops max, 60 byte packets 1 * * * 2 * * * Does that mean my host is blocking it ? Im using vultr
    – jotyhista
    Feb 17, 2018 at 18:50
  • actually a quick google shows that vultr blocks port 25 :( not sure how to get around it; I opened a ticket
    – jotyhista
    Feb 17, 2018 at 18:57
  • In vultr they provide this solution using exim. Feb 17, 2018 at 19:25
1

Receiving emails:

Based on your netstat -ntlp | grep sendmail output, your server is just listening in localhost (127.0.0.1), not in your IP address. If you want to receive emails, check this.

Sending emails:

Verify:

  • DNS: host -t mx gmail.com. The answer looks like this:

    gmail.com mail is handled by 10 alt1.gmail-smtp-in.l.google.com.
    gmail.com mail is handled by 20 alt2.gmail-smtp-in.l.google.com.
    gmail.com mail is handled by 40 alt4.gmail-smtp-in.l.google.com.
    gmail.com mail is handled by 5 gmail-smtp-in.l.google.com.
    gmail.com mail is handled by 30 alt3.gmail-smtp-in.l.google.com.
    
  • More DNS: host alt4.gmail-smtp-in.l.google.com (or another gmail SMTP server). The answer looks like this:

    alt4.gmail-smtp-in.l.google.com has address 209.85.202.27
    alt4.gmail-smtp-in.l.google.com has IPv6 address 2a00:1450:400b:c00::1a
    
  • SMTP port access: nc -vv alt4.gmail-smtp-in.l.google.com 25 You should receive a 220 code:

    220 mx.google.com ESMTP 7si2060923qty.86 - gsmtp [831 ms]
    

If not, maybe your ISP is blocking port 25 and you could try use SMTP over SSL (port 465) or SMTP Submission (port 587).

3
  • the first two are ok but the last returns DNS fwd/rev mismatch: alt4.gmail-smtp-in.l.google.com != pc-in-f26.1e100.net I need to change port ?
    – jotyhista
    Feb 17, 2018 at 18:26
  • Do you get a 220 code? Or something like "Ncat: Network is unreachable." Feb 17, 2018 at 19:04
  • And try this: nc -vv -n 209.85.202.27 25 Feb 17, 2018 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .