7
SmarterMail API Python Wrapper
Announcement by Zach Sylvester - 7/26/2021 at 10:39 AM
Employee Post
Hello Everyone, 
 
I just wanted to share a Python wrapper I have been making for SmarterMail. This wrapper makes it really easy to use SmarterMail's API functions. It is still a work in progress; I plan to add more functionality to it as time goes on. It is also an open-source project, so if anyone wants to improve it or add more functionality feel free. Here is the GitHub link:
https://github.com/zjs81/SmarterToolsPythonWrapper  
 
My hope with this project is that it will allow more people to use the API with less obstruction in the code.  
Here's what I mean by that. 
 
Example: 
Say you want to send a message...
 
import smapi

me = smapi.SMAPI("account@example.com","password","http://smartermailurl.com";)

me.auth()

me.SendMessage("account@example.com","toemail@example.com","this is the subject","this is the body")
 
Since the wrapper handles the authentication and the post request, you can do this with just a simple function.  

Please let me know what you all think. 
 
Best Regards,
Zach Sylvester
Technical Support Specialist
SmarterTools Inc.
(877) 357-6278
www.smartertools.com

6 Replies

Reply to Thread
0
Excuse my ignorance but what is supposed to go in the requests include?
I get error without one and its not clear:
ModuleNotFoundError: No module named 'requests'

0
Zach Sylvester Replied
Employee Post
Hey Sam, 

Thanks for reaching out with your question. This requires the request library. To install it you need to type. 
pip install requests 
In the cmd then it should install this library for you. 

Please let me know if this helps. 

Kind Regards, 
Zach Sylvester
Technical Support Specialist
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
0
Thanks Zach,
That fixed it but the CSV when i try a function has this in 1 column and nothing else:
x = "Could not get claims principal with token true"
0
Zach Sylvester Replied
Employee Post
Hey Sam, 

Which function are you trying to run?

Looking forward to hearing from you. 

Kind Regards, 
Zach Sylvester
Technical Support Specialist
SmarterTools Inc.
(877) 357-6278
www.smartertools.com
0
Tried several of them in Example_Functions.py
For example me.SystemExportDomainsListToFile("test.csv") which produced the csv with:
x = "Could not get claims principal with token true" 
0
Zach Sylvester Replied
Employee Post
Hey Sam, 

What version of SmarterMail are you running and are you using the system admin user?
I just tested this with this code and it worked. 
Kind Regards, 
Zach Sylvester
Technical Support Specialist
SmarterTools Inc.
(877) 357-6278
www.smartertools.com

Reply to Thread