I have noticed that the name of my private server running dovecot appears in email headers rather than the public-friendly name of my server. Is there a method to specify an alternate server name for the dovecot server to use for itself in the dovecot configuration files? I performed a few Google searches and was not able to find the answer to my question. ------- user at server1:~$ dovecot --version 2.2.9 user at server1:~$ dovecot -n # 2.2.9: /etc/dovecot/dovecot.conf # OS: Linux 3.16.0-77-generic x86_64 Ubuntu 14.04.4 LTS ext4 auth_mechanisms = plain login info_log_path = /var/log/dovecot.log log_path = /var/log/dovecot.log mail_location = maildir:/var/mail/vhosts/%d/%n namespace inbox { inbox = yes location mailbox Drafts { special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Trash { special_use = \Trash } prefix } passdb { args = scheme=PLAIN username_format=%u /etc/dovecot/dovecot-users driver = passwd-file } protocols = " imap lmtp pop3" service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0666 user = postfix } } service imap-login { inet_listener imaps { port = 993 ssl = yes } } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0600 user = postfix } } service pop3-login { inet_listener pop3s { port = 995 ssl = yes } } ssl = required ssl_cert = </etc/ssl/certs/server1_combined.pem ssl_key = </etc/ssl/private/server1_key.pem userdb { args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n driver = static }
Hi, Looking at the source code it seems that the fqdn used in the lmtp received headers is fetched from environment variable DOVECOT_HOSTDOMAIN and if that is not defined gethostbyname() is used. You can try setting that prior launching dovecot. Sami> On 19 Aug 2016, at 21:43, Scott W. Sander <scottwsx96 at gmail.com> wrote: > > I have noticed that the name of my private server running dovecot appears > in email headers rather than the public-friendly name of my server. > > Is there a method to specify an alternate server name for the dovecot > server to use for itself in the dovecot configuration files? I performed a > few Google searches and was not able to find the answer to my question. > > ------- > > user at server1:~$ dovecot --version > 2.2.9 > user at server1:~$ dovecot -n > # 2.2.9: /etc/dovecot/dovecot.conf > # OS: Linux 3.16.0-77-generic x86_64 Ubuntu 14.04.4 LTS ext4 > auth_mechanisms = plain login > info_log_path = /var/log/dovecot.log > log_path = /var/log/dovecot.log > mail_location = maildir:/var/mail/vhosts/%d/%n > namespace inbox { > inbox = yes > location > mailbox Drafts { > special_use = \Drafts > } > mailbox Junk { > special_use = \Junk > } > mailbox Sent { > special_use = \Sent > } > mailbox "Sent Messages" { > special_use = \Sent > } > mailbox Trash { > special_use = \Trash > } > prefix > } > passdb { > args = scheme=PLAIN username_format=%u /etc/dovecot/dovecot-users > driver = passwd-file > } > protocols = " imap lmtp pop3" > service auth { > unix_listener /var/spool/postfix/private/auth { > group = postfix > mode = 0666 > user = postfix > } > } > service imap-login { > inet_listener imaps { > port = 993 > ssl = yes > } > } > service lmtp { > unix_listener /var/spool/postfix/private/dovecot-lmtp { > group = postfix > mode = 0600 > user = postfix > } > } > service pop3-login { > inet_listener pop3s { > port = 995 > ssl = yes > } > } > ssl = required > ssl_cert = </etc/ssl/certs/server1_combined.pem > ssl_key = </etc/ssl/private/server1_key.pem > userdb { > args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n > driver = static > }
I'll check out the environment variable method, but I also ran "doveconf | grep hostname" and it returned "hostname = ". This leads me to believe it might be possible to specify a hostname directive in one of Dovecot's configuration files. The problem is 1) I'm not sure that it is truly possible to specify the Dovecot hostname in a configuration file and 2) I'm not sure which configuration file and section it should be placed in. On Tue, Aug 23, 2016 at 4:58 AM Sami Ketola <sami.ketola at dovecot.fi> wrote:> Hi, > > Looking at the source code it seems that the fqdn used in the lmtp > received headers is > fetched from environment variable DOVECOT_HOSTDOMAIN and if that is not > defined > gethostbyname() is used. > > You can try setting that prior launching dovecot. > > Sami > > > > On 19 Aug 2016, at 21:43, Scott W. Sander <scottwsx96 at gmail.com> wrote: > > > > I have noticed that the name of my private server running dovecot appears > > in email headers rather than the public-friendly name of my server. > > > > Is there a method to specify an alternate server name for the dovecot > > server to use for itself in the dovecot configuration files? I > performed a > > few Google searches and was not able to find the answer to my question. > > > > ------- > > > > user at server1:~$ dovecot --version > > 2.2.9 > > user at server1:~$ dovecot -n > > # 2.2.9: /etc/dovecot/dovecot.conf > > # OS: Linux 3.16.0-77-generic x86_64 Ubuntu 14.04.4 LTS ext4 > > auth_mechanisms = plain login > > info_log_path = /var/log/dovecot.log > > log_path = /var/log/dovecot.log > > mail_location = maildir:/var/mail/vhosts/%d/%n > > namespace inbox { > > inbox = yes > > location > > mailbox Drafts { > > special_use = \Drafts > > } > > mailbox Junk { > > special_use = \Junk > > } > > mailbox Sent { > > special_use = \Sent > > } > > mailbox "Sent Messages" { > > special_use = \Sent > > } > > mailbox Trash { > > special_use = \Trash > > } > > prefix > > } > > passdb { > > args = scheme=PLAIN username_format=%u /etc/dovecot/dovecot-users > > driver = passwd-file > > } > > protocols = " imap lmtp pop3" > > service auth { > > unix_listener /var/spool/postfix/private/auth { > > group = postfix > > mode = 0666 > > user = postfix > > } > > } > > service imap-login { > > inet_listener imaps { > > port = 993 > > ssl = yes > > } > > } > > service lmtp { > > unix_listener /var/spool/postfix/private/dovecot-lmtp { > > group = postfix > > mode = 0600 > > user = postfix > > } > > } > > service pop3-login { > > inet_listener pop3s { > > port = 995 > > ssl = yes > > } > > } > > ssl = required > > ssl_cert = </etc/ssl/certs/server1_combined.pem > > ssl_key = </etc/ssl/private/server1_key.pem > > userdb { > > args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n > > driver = static > > } >
Well, I tried setting the following in /etc/environment and restarting the server: DOVECOT_HOSTDOMAIN="mail.domain.test" After doing so, I verified that the command "dovecot --hostdomain" returned "mail.domain.test" and not "appserver4.domain.com"; however, the email received header still shows: Received: from mail.domain.test by appserver4.domain.com (Dovecot) with LMTP id .... I also tried adding the following line to /etc/dovecot/conf.d/10-master.conf and restarting the dovecot service: hostname = mail.domain.test doveconf shows that "hostname = mail.domain.test", and now the received headers show: Received: from mail.domain.test by mail.domain.test (Dovecot) with LMTP id .... So it seems that "hostname" is a valid, respected Dovecot directive. --- Scott On Tue, Aug 23, 2016 at 4:58 AM Sami Ketola <sami.ketola at dovecot.fi> wrote:> Hi, > > Looking at the source code it seems that the fqdn used in the lmtp > received headers is > fetched from environment variable DOVECOT_HOSTDOMAIN and if that is not > defined > gethostbyname() is used. > > You can try setting that prior launching dovecot. > > Sami > > > > On 19 Aug 2016, at 21:43, Scott W. Sander <scottwsx96 at gmail.com> wrote: > > > > I have noticed that the name of my private server running dovecot appears > > in email headers rather than the public-friendly name of my server. > > > > Is there a method to specify an alternate server name for the dovecot > > server to use for itself in the dovecot configuration files? I > performed a > > few Google searches and was not able to find the answer to my question. > > > > ------- > > > > user at server1:~$ dovecot --version > > 2.2.9 > > user at server1:~$ dovecot -n > > # 2.2.9: /etc/dovecot/dovecot.conf > > # OS: Linux 3.16.0-77-generic x86_64 Ubuntu 14.04.4 LTS ext4 > > auth_mechanisms = plain login > > info_log_path = /var/log/dovecot.log > > log_path = /var/log/dovecot.log > > mail_location = maildir:/var/mail/vhosts/%d/%n > > namespace inbox { > > inbox = yes > > location > > mailbox Drafts { > > special_use = \Drafts > > } > > mailbox Junk { > > special_use = \Junk > > } > > mailbox Sent { > > special_use = \Sent > > } > > mailbox "Sent Messages" { > > special_use = \Sent > > } > > mailbox Trash { > > special_use = \Trash > > } > > prefix > > } > > passdb { > > args = scheme=PLAIN username_format=%u /etc/dovecot/dovecot-users > > driver = passwd-file > > } > > protocols = " imap lmtp pop3" > > service auth { > > unix_listener /var/spool/postfix/private/auth { > > group = postfix > > mode = 0666 > > user = postfix > > } > > } > > service imap-login { > > inet_listener imaps { > > port = 993 > > ssl = yes > > } > > } > > service lmtp { > > unix_listener /var/spool/postfix/private/dovecot-lmtp { > > group = postfix > > mode = 0600 > > user = postfix > > } > > } > > service pop3-login { > > inet_listener pop3s { > > port = 995 > > ssl = yes > > } > > } > > ssl = required > > ssl_cert = </etc/ssl/certs/server1_combined.pem > > ssl_key = </etc/ssl/private/server1_key.pem > > userdb { > > args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n > > driver = static > > } >