#!/bin/bash
. /usr/lib/eole/diagnose.sh
if [ "$(CreoleGet activer_recuperation_courriel)" = 'non' ]; then
    Inactif "Courrier POP/IMAP"
else
    activer_courier_imap=$(CreoleGet activer_courier_imap)
    activer_courier_pop=$(CreoleGet activer_courier_pop)
    container_ip_mail=$(CreoleGet container_ip_mail)
    container_path_mail=$(CreoleGet container_path_mail)

    if [ "$activer_courier_imap" = 'oui' ]; then
        TestService "Courrier IMAP" "$container_ip_mail":143
        TestCerts "$container_path_mail"/etc/courier/imapd.pem 10 "certificat expiré"
    fi
    if [ "$activer_courier_pop" = 'oui' ]; then
        TestService "Courrier POP" "$container_ip_mail":110
        TestCerts "$container_path_mail"/etc/courier/pop3d.pem 10 "certificat expiré"
    fi
fi
echo
exit 0
