Error when sending smtp email: No module named 'email.MIMEMultipart'

8,924 views
Skip to first unread message

Jerome Gay

unread,
Feb 7, 2014, 1:16:33 PM2/7/14
to eventandt...@googlegroups.com
Hi there,

I'm using etm_qt 2.3.22 on Windows 7, while trying to use email notifications, I ran into the following error :

Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\etm_qt-2.3.22-py3.3.egg\etmQt\etmView.py", line 4448, in timeout smtp_pw=self.options['smtp_pw'])
  File "C:\Python33\lib\site-packages\etm_qt-2.3.22-py3.3.egg\etmQt\etmData.py", line 513, in send_mail from email.MIMEMultipart import MIMEMultipart
ImportError: No module named 'email.MIMEMultipart'

Here is the line of the datafile I used:

- test email @s 2014-02-07 19h07 @z Europe/Amsterdam @a 0m: e; reci...@domain.com

Here is the etm.cfg section I used (parts in bracket have been modified for privacy)

smtp_from: 'jer...@gmail.com'
smtp_id: 'jeromg'
smtp_pw: '[SUB AUTH TOKEN]'
smtp_server: 'smtp.gmail.com:587'

I've successfully tested the parameters (smtp server, port, username, password, recipient) using a plain smtp client.

Thanks for your help.

Cheers  /jerome

Daniel Graham

unread,
Feb 7, 2014, 2:33:20 PM2/7/14
to eventandt...@googlegroups.com
Try starting python in a terminal window and then enter:

    from email.mime.multipart import MIMEMultipart

and let me know how it goes.  If it works, then this is another windows feature and the following patch will hopefully fix the problem.

diff -r 1fe1917878da etmQt/etmData.py
--- a/etmQt/etmData.py    Mon Feb 03 14:13:07 2014 -0500
+++ b/etmQt/etmData.py    Fri Feb 07 14:19:59 2014 -0500
@@ -510,12 +510,18 @@
 def send_mail(smtp_to, subject, message, files=[], smtp_from=None,
               smtp_server=None, smtp_id=None, smtp_pw=None):
     import smtplib
-    from email.MIMEMultipart import MIMEMultipart
-    from email.MIMEBase import MIMEBase
-    from email.MIMEText import MIMEText
-    from email.Utils import COMMASPACE, formatdate
-    from email import Encoders
-
+    if windoz:
+        from email.mime.multipart import MIMEMultipart
+        from email.mime.base import MIMEBase
+        from email.mime.text import MIMEText
+        from email.utils import COMMASPACE, formatdate
+        from email import encoders
+    else:
+        from email.MIMEMultipart import MIMEMultipart
+        from email.MIMEBase import MIMEBase
+        from email.MIMEText import MIMEText
+        from email.Utils import COMMASPACE, formatdate
+        from email import Encoders
     assert type(smtp_to) == list
     assert type(files) == list

This will be in the next release but it will be a couple of weeks before I release it.

It's nice to have a Windows user who tries out all this stuff and lets me know what doesn't work. Thanks!

-Dan
February 7, 2014 at 1:16 PM
--
You received this message because you are subscribed to the Google Groups "Event and Task Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eventandtaskman...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages