./check_email_delivery --mailto [email protected] --mailfrom [email protected] -H outlook.office365.com --smtp-server smtp.office365.com --smtp-username '[email protected]' --smtp-password 'NagRules08' --smtp-port 587 --imap-server outlook.office365.com --username '[email protected]' --password 'NagRules08' --imap-port 993 --smtptls --imapssl
EMAIL DELIVERY CRITICAL - imap failed: IMAP RECEIVE CRITICAL - Could not connect to outlook.office365.com port 993: IO::Socket::INET configuration failederror:00000000:lib(0):func(0):reason(0) (if you get this only when using both --ssl and --ssl-ca-file, but not when using just --ssl, the server SSL certificate failed validation) at /usr/local/nagios/libexec/check_imap_receive line 140.
I think the server for the -H "Hostname" variable needs to be set to the smtp server at office365. Can you edit your command to the following and let us know if this works for you?
EMAIL DELIVERY CRITICAL - imap failed: IMAP RECEIVE CRITICAL- Could not connect to outlook.office365.com port 993: IO::Socket::INET configuration failederror:00000000:lib(0):func(0):reason(0) (if you get this only when using both --ssl and --ssl-ca-file, but not when using just --