You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/01/11 07:08:56 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #20441: Add "use_ssl" option to IMAP connection

uranusjr commented on a change in pull request #20441:
URL: https://github.com/apache/airflow/pull/20441#discussion_r781805723



##########
File path: airflow/providers/imap/hooks/imap.py
##########
@@ -71,10 +71,11 @@ def get_conn(self) -> 'ImapHook':
         """
         if not self.mail_client:
             conn = self.get_connection(self.imap_conn_id)
-            if conn.port:
-                self.mail_client = imaplib.IMAP4_SSL(conn.host, conn.port)
-            else:
-                self.mail_client = imaplib.IMAP4_SSL(conn.host)
+
+            if conn.extra_dejson.get('use_ssl', True):
+                self.mail_client = imaplib.IMAP4_SSL(conn.host, conn.port or imaplib.IMAP4_SSL_PORT)
+            else:  # fallback to standard imap connection
+                self.mail_client = imaplib.IMAP4(conn.host, conn.port or imaplib.IMAP4_PORT)

Review comment:
       See discussions in #20651 for context why we explicitly chose to _not_ implement this the way you’re doing it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org