src/eric7/UI/EmailDialog.py

branch
eric7
changeset 9427
905e7af29101
parent 9413
80c06d472826
child 9473
3f23dbf37dbe
--- a/src/eric7/UI/EmailDialog.py	Thu Oct 20 10:22:41 2022 +0200
+++ b/src/eric7/UI/EmailDialog.py	Thu Oct 20 19:19:00 2022 +0200
@@ -163,12 +163,10 @@
 
                 helpStr = GoogleMailHelp()
             except ImportError:
-                from eric7.EricNetwork.EricGoogleMailHelpers import getInstallCommand
-
                 helpStr = self.tr(
                     "<p>The Google Mail Client API is not installed."
-                    " Use <code>{0}</code> to install it.</p>"
-                ).format(getInstallCommand())
+                    " Change to the Email configuration page for more.</p>"
+                )
 
             from eric7.EricWidgets.EricSimpleHelpDialog import EricSimpleHelpDialog
 
@@ -410,13 +408,23 @@
         @param msg email message to be sent
         @type email.mime.text.MIMEBase
         """
-        from eric7.EricNetwork.EricGoogleMail import EricGoogleMail
+        try:
+            from eric7.EricNetwork.EricGoogleMail import EricGoogleMail
+
+            if self.__googleMail is None:
+                self.__googleMail = EricGoogleMail(self)
+                self.__googleMail.sendResult.connect(self.__gmailSendResult)
 
-        if self.__googleMail is None:
-            self.__googleMail = EricGoogleMail(self)
-            self.__googleMail.sendResult.connect(self.__gmailSendResult)
-
-        self.__googleMail.sendMessage(msg)
+            self.__googleMail.sendMessage(msg)
+        except ImportError:
+            EricMessageBox.critical(
+                self,
+                self.tr("Send Message"),
+                self.tr(
+                    "The Google Mail Client API is not installed. The message cannot be"
+                    " sent."
+                ),
+            )
 
     @pyqtSlot(bool, str)
     def __gmailSendResult(self, ok, message):

eric ide

mercurial