jonrob.net



Stopping Mutt Calling Out

When launching the Mutt e-mail client without a network connection I noticed it takes a long time to load, whilst I sometimes use network outages to catch up on e-mails this was mostly to satisfy my curiousity as to what Mutt could be calling out for.
This code causing this is in the middle of the mutt_init routine where it does a DNS query on your FQDN unless you set the domain name at compile time, this is here:
[1]
#ifdef DOMAIN
  domain = safe_strdup (DOMAIN);
#endif /* DOMAIN */
...
  /* now get FQDN.  Use configured domain first, DNS next, then uname */
  if (domain)
  {
    /* we have a compile-time domain name, use that for Fqdn */
    Fqdn = safe_malloc (mutt_strlen (domain) + mutt_strlen (Hostname) + 2);
    sprintf (Fqdn, "%s.%s", NONULL(Hostname), domain); /* __SPRINTF_CHECKED__ */
  }
  else if (!(getdnsdomainname (buffer, sizeof buffer)))
  {
    Fqdn = safe_malloc (mutt_strlen (buffer) + mutt_strlen (Hostname) + 2);
    sprintf (Fqdn, "%s.%s", NONULL(Hostname), buffer); /* __SPRINTF_CHECKED__ */
  }
  else
    Fqdn = safe_strdup(utsname.nodename);
So to avoid your FQDN being looked up every time you launch Mutt you can either ./configure Mutt with --with-domain"example.com" or add your hostname to /etc/hosts.
Whilst it's reassuring that Mutt is only looking up the information it needs for local e-mail to function I'd rather it didn't try to lookup my FQDN and just took the options from .muttrc.
[1] - https://gitlab.com/muttmua/mutt/-/blob/mutt-1-13-5-rel/init.h
/*
 * Copyright (C) 1996-2002,2007,2010,2012-2013,2016 Michael R. Elkins 
 * Copyright (C) 2004 g10 Code GmbH
 *
 *     This program is free software; you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with this program; if not, write to the Free Software
 *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */