sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #26374
Re: [Question #241177]: How to send an email over SSL using the smtplib module
Question #241177 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/241177
RaiMan proposed the following answer:
@ Ador
Using a Python module in Sikuli (which uses the Java based Jython interpreter) might not work as expected:
- it does not work at all, since the module contains C-based code (e.g. Win32API)
- it is available, but has differences in the API or some features are missing completely
The core Python modules (we are talking about CPython here) had to be rewritten in Java for Jython and still are not completely available. The nearer the module is to system dependent features (like networking) the harder the job to transfer it to Java.
If a module is totally written in Python language (like xlrd), it
usually can be used in Jython out of the box.
In many cases it is a good choice, to look for a feature compatible Java
module and use this in your Jython script instead.
The last way out: in a subprocess let the Python interpreter run your
email snippet.
*** your case
you get this message:
error] SystemExit ( mail failed; Connection unexpectedly closed: [Errno -1] SSL exception: Differences between the SSL socket behaviour of cpython vs. jython are explained on the wiki: http://wiki.python.org/jython/NewSocketModule#SSL_Support )
If you read through the mentioned wiki entry, you can see, that there are some exceptions with SSL (mainly handling certificates), that are implemented (or not implemented) like in the CPython module.
And this might be the reason for not working with your usage of the gmail server.
... and I found an entry in the net, that talks about smtplib-ssl with
Jython 2.7 (which is used in 1.1.0-Beta1) having big problems with gmail
accounts. What he did was running with Jython 2.5, but it was a more
complete approach than yours including the handling of certificates.
One idea mentioned in the wiki entry might be interesting: If you
encrypt the content of your mail yourself before sending, you might use
an unsecured mail account (which definitely works without problems (see
Mark's comment)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.