mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 01:47:36 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			621 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			621 B
		
	
	
	
		
			Python
		
	
	
	
	
	
"""Example adapters package."""
 | 
						|
 | 
						|
 | 
						|
class EmailSender:
 | 
						|
    """Abstract email sender."""
 | 
						|
 | 
						|
    def send(self, to, body):
 | 
						|
        """Send email to specified email."""
 | 
						|
        raise NotImplementedError()
 | 
						|
 | 
						|
 | 
						|
class SmtpEmailSender:
 | 
						|
    """SMTP email sender uses SMTP protocol for sending emails."""
 | 
						|
 | 
						|
    def send(self, to, body):
 | 
						|
        """Send email to specified email."""
 | 
						|
        # Send email via SMTP
 | 
						|
 | 
						|
 | 
						|
class EchoEmailSender:
 | 
						|
    """Echo email sender prints emails to stdout."""
 | 
						|
 | 
						|
    def send(self, to, body):
 | 
						|
        """Send email to specified email."""
 | 
						|
        print('Sending email to "{0}", body = "{1}"'.format(to, body))
 |