{
    $OUT = '';
    return unless ($fetchmail{status} eq 'enabled' && $fetchmail{Method} eq 'etrn');

    $OUT .= "# ETRN configuration; fetchmail sends ETRN command ";
    $OUT .= "to flush mail from remote mail server:\n";
    $OUT .= "\n";

    my $verbosity = $fetchmail{Verbosity} || "--silent";
    my $SecondaryMailServer = $fetchmail{SecondaryMailServer};

    use esmith::DomainsDB;

    my $ddb = esmith::DomainsDB->open_ro or die "Could not open domains DB\n";

    my @domains = map { $_->key } $ddb->get_all;
    $OUT .= "/usr/bin/fetchmail --syslog $verbosity --protocol ";
    $OUT .= "ETRN --fetchdomains " . join(',', @domains);
    $OUT .= " $SecondaryMailServer ";
    $OUT .= "> /dev/null 2>&1\n";
}
