from sparkpost import SparkPost
sp = SparkPost('YOUR API KEY')
response = sp.transmissions.send(
use_sandbox=True,
recipients=['som...@somedomain.com'],
html='<p>Hello world</p>',
from_email='te...@sparkpostbox.com',
subject='Hello from python-sparkpost'
)
print(response)
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
Sparkpost has simple python api:
from sparkpost import SparkPost
sp = SparkPost('YOUR API KEY')
response = sp.transmissions.send(
use_sandbox=True,
recipients=['someone@somedomain.com'],
html='<p>Hello world</p>',
from_email='test@sparkpostbox.com',
subject='Hello from python-sparkpost'
)
print(response)
However I get the following error:
C:\Temp\web2py_src\web2py>python web2py.py -S welcomeNo handlers could be found for logger "web2py"web2py Web FrameworkCreated by Massimo Di Pierro, Copyright 2007-2017Version 2.14.6-stable+timestamp.2016.05.10.00.21.47Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, pyodbcWARNING:web2py:import IPython error; use default python shellPython 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32Type "help", "copyright", "credits" or "license" for more information.(InteractiveConsole)>>> variables= {}>>> execfile( "/temp/mailtest.py", variables ){u'total_accepted_recipients': 1, u'id': u'48590550571575300', u'total_rejected_recipients': 0}>>>
Enter code here...>>> variables= {}
First of all I recommend you configure sparkpost using web2py auth.mailer SMTP else you do not get the benefit of auth email logic.Also, I recommend you run web2py from source, not the windows binary. I will give you more control. If you find that running from source makes the problem go away, please let us know.
Massimo
On Friday, 9 June 2017 02:48:55 UTC-5, icodk wrote:
Sparkpost has simple python api:
from sparkpost import SparkPost
sp = SparkPost('YOUR API KEY')
response = sp.transmissions.send(
use_sandbox=True,
recipients=['som...@somedomain.com'],
html='<p>Hello world</p>',
from_email='te...@sparkpostbox.com',
subject='Hello from python-sparkpost'
)
print(response)
However I get the following error:
Sparkpost has simple python api:
from sparkpost import SparkPost
sp = SparkPost('YOUR API KEY')
response = sp.transmissions.send(
use_sandbox=True,
recipients=['someone@somedomain.com'],
html='<p>Hello world</p>',
from_email='test@sparkpostbox.com',
subject='Hello from python-sparkpost'
)
print(response)
However I get the following error:
Sorry for the late responseThere is definitly a different if I use web2py shell source to send mail or web2py.exeIt works fine with source and failes with web2py.exeMy python installation is 2.7.13
python web2py.py -i 0.0.0.0 -p 8000
here is my source execution :
C:\Temp\web2py_src\web2py>python web2py.py -S welcomeNo handlers could be found for logger "web2py"web2py Web FrameworkCreated by Massimo Di Pierro, Copyright 2007-2017Version 2.14.6-stable+timestamp.2016.05.10.00.21.47Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, pyodbcWARNING:web2py:import IPython error; use default python shellPython 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32