2019-07-19 20:52:54 Connection: opening to smtp.office365.com:587, timeout=300, options=array ( ) 2019-07-19 20:52:59 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to smtp.office365.com:587 (Connection refused) 2019-07-19 20:52:59 SMTP ERROR: Failed to connect to server: Connection refused (111) 2019-07-19 20:52:59 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting