""" Test 1: Send Email Demonstrates creating an inbox and sending an email. """ import os import sys sys.path.insert(0, ".") from agent_email import AgentEmailTool # Set API key (use env var or set directly) os.environ["AGENTMAIL_API_KEY"] = "your-api-key-here" def test_send_email(): """Test sending an email""" # Initialize tool tool = AgentEmailTool(agent_id="sofiia-test") # Create inbox (or use existing) print("Creating inbox...") inbox = tool.create_inbox( username="sofiia-test", display_name="Sofiia Test Agent" ) print(f"Inbox created: {inbox['email_address']}") # Send email print("\nSending email...") result = tool.send( to=["recipient@example.com"], subject="Test from Sofiia Agent", body="""Hello! This is a test email sent from Sofiia Agent via AgentMail. Best regards, Sofiia""", html="""
Hello!
This is a test email sent from Sofiia Agent via AgentMail.
Best regards,
Sofiia