11import os
22
3- from devo_global_comms_python import DevoException
3+ from devo_global_comms_python import DevoCommsClient , DevoException
44
55
66def main ():
@@ -9,42 +9,72 @@ def main():
99 print ("❌ Please set DEVO_API_KEY environment variable" )
1010 return
1111
12+ client = DevoCommsClient (api_key = api_key )
1213 print ("✅ Devo Email Client initialized successfully" )
1314 print ("=" * 60 )
1415
1516 try :
16- # Example 1 : Send a simple email
17+ # Example: Send an email using the Email API
1718 print ("📧 EMAIL SEND EXAMPLE" )
1819 print ("-" * 30 )
1920
2021 print ("📤 Sending email..." )
21- print ("⚠️ This is a placeholder implementation." )
22- print (" Update this example when Email API is implemented." )
23-
24- # Placeholder email send - update when implementing Email resource
25- print (" ```python" )
26- print (" email_response = client.email.send(" )
27- print (" to='recipient@example.com'," )
28- print (" subject='Test Email from Devo SDK'," )
29- print (" body='This is a test email.'," )
30- print (" html_body='<h1>Test</h1><p>This is a test email.</p>'," )
31- print (" from_email='sender@yourdomain.com'" )
32- print (" )" )
33- print (" print(f'Email sent! ID: {email_response.id}')" )
34- print (" ```" )
22+ email_response = client .email .send_email (
23+ subject = "Test Email from Devo SDK" ,
24+ body = "This is a test email sent using the Devo Global Communications Python SDK." ,
25+ sender = "sender@example.com" ,
26+ recipient = "recipient@example.com" ,
27+ )
28+
29+ print ("✅ Email sent successfully!" )
30+ print (f" 📧 Message ID: { email_response .message_id } " )
31+ print (f" 📦 Bulk Email ID: { email_response .bulk_email_id } " )
32+ print (f" 📝 Subject: { email_response .subject } " )
33+ print (f" 📊 Status: { email_response .status } " )
34+ print (f" 💬 Message: { email_response .message } " )
35+ print (f" 🕐 Timestamp: { email_response .timestamp } " )
36+ print (f" ✅ Success: { email_response .success } " )
37+
38+ # Example with different content
39+ print ("\n 📧 SENDING EMAIL WITH RICH CONTENT" )
40+ print ("-" * 40 )
41+
42+ rich_email_response = client .email .send_email (
43+ subject = "🎉 Welcome to Devo Communications!" ,
44+ body = (
45+ "Dear valued customer,\n \n "
46+ "Welcome to our service! We're excited to have you on board.\n \n "
47+ "Best regards,\n The Devo Team"
48+ ),
49+ sender = "welcome@yourcompany.com" ,
50+ recipient = "newcustomer@example.com" ,
51+ )
52+
53+ print ("✅ Rich content email sent!" )
54+ print (f" 📧 Message ID: { rich_email_response .message_id } " )
55+ print (f" 📊 Status: { rich_email_response .status } " )
56+ print (f" ✅ Success: { rich_email_response .success } " )
3557
3658 except DevoException as e :
3759 print (f"❌ Email operation failed: { e } " )
60+ except Exception as e :
61+ print (f"❌ Unexpected error: { e } " )
3862
3963 print ("\n " + "=" * 60 )
4064 print ("📊 EMAIL EXAMPLE SUMMARY" )
4165 print ("-" * 30 )
42- print ("⚠️ This is a placeholder example for Email functionality." )
43- print ("💡 To implement:" )
44- print (" 1. Define Email API endpoints and specifications" )
45- print (" 2. Create Email Pydantic models" )
46- print (" 3. Implement EmailResource class" )
47- print (" 4. Update this example with real functionality" )
66+ print ("✅ Email API implementation complete!" )
67+ print ("📤 Successfully demonstrated:" )
68+ print (" • Basic email sending" )
69+ print (" • Email with rich content and emojis" )
70+ print (" • Response parsing and status checking" )
71+ print (" • Error handling" )
72+ print ("\n 💡 Features available:" )
73+ print (" • Subject and body content" )
74+ print (" • Sender and recipient validation" )
75+ print (" • Message tracking with unique IDs" )
76+ print (" • Status monitoring" )
77+ print (" • Timestamp tracking" )
4878
4979
5080if __name__ == "__main__" :
0 commit comments