I’ve been trying to achieve a working mail setup on nixos by using simple-nixos-mailserver.
mailserver = {
enable = true;
certificateScheme = "acme-nginx";
enableManageSieve = true;
fqdn = "email.teatastic.org";
domains = ["teatastic.org"];
mailboxes = {
Drafts = {
auto = "subscribe";
specialUse = "Drafts";
};
Junk = {
auto = "subscribe";
specialUse = "Junk";
};
Sent = {
auto = "subscribe";
specialUse = "Sent";
};
Trash = {
auto = "no";
specialUse = "Trash";
};
};
loginAccounts = {
"user1@teatastic.org" = {
hashedPasswordFile = config.sops.secrets.password.path;
aliases = ["postmaster@teatastic.org"];
};
};
fullTextSearch = {
enable = false;
enforced = "body";
indexAttachments = true;
memoryLimit = 512;
};
enableImap = true;
enablePop3 = true;
enableImapSsl = true;
enablePop3Ssl = true;
virusScanning = false;
};
services.roundcube = {
enable = true;
package = pkgs.roundcube.withPlugins (
plugins: [
plugins.carddav
plugins.contextmenu
plugins.custom_from
plugins.persistent_login
plugins.thunderbird_labels
]
);
plugins = [
"attachment_reminder" # Roundcube internal plugin
"carddav"
"contextmenu"
"custom_from"
"managesieve" # Roundcube internal plugin
"newmail_notifier" # Roundcube internal plugin
"persistent_login"
"thunderbird_labels"
"zipdownload" # Roundcube internal plugin
];
#dicts = with pkgs.aspellDicts; [en];
hostName = config.mailserver.fqdn;
maxAttachmentSize = 100;
extraConfig = ''
$config['smtp_server'] = "tls://${config.mailserver.fqdn}";
$config['smtp_user'] = "%u";
$config['smtp_pass'] = "%p";
'';
};
security.acme = {
acceptTerms = true;
defaults.email = "user1@teatastic.org";
};
firewall = {
enable = true;
allowedTCPPorts = [
25 587 143 993 110 995 # Email
80 # Nginx
];
};
I’m logging in through roundcube, which works as expected. However, when I get to the point of composing an email to somebody, it just starts a “Sending message…” loop without actually sending anything.
I’ve forwarded the aforementioned ports on my router, yet it fails.
I’m not sure if this would cause the issues you are seeing, but ensure your hosting provider allows you to make outgoing connections over port 25. A number of them block it for spam reasons.