9
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

Software Developer
SmarterTools Inc.

9 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 Software Developer SmarterTools Inc. 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 Software Developer SmarterTools Inc. 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 Software Developer SmarterTools Inc. www.smartertools.com
1
Zach Sylvester Replied
Employee Post
I just refactored and published this module on PIP. 
Check out the GitHub page. 
https://github.com/zjs81/SmarterToolsPythonWrapper
Zach Sylvester Software Developer SmarterTools Inc. www.smartertools.com
0
Hey Zachl !
So, I have still not gotten the ASP API thing going. But I really need to get this done here in the next few weeks.   Sorry, but I need a sample to see it. Apparently I am doing something wrong and just really not sure what that is. mI thought you posted an ASP version someplace, but I cant seem to find it.

So, Can someone provide me a full example of making the connection and sending a basic email with ASP ?

www.HawaiianHope.org - Providing technology services to non profit organizations, low income families, homeless shelters, clean and sober houses and prisoner reentry programs. Since 2015, We have refurbished over 11,000 Computers !
0
Tony Scholz Replied
Employee Post
Tony Scholz System/Network Administrator SmarterTools Inc. www.smartertools.com

Reply to Thread