Skip to content

invictuscapital/nameko-sendgrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nameko-sendgrid

SendGrid dependency for nameko services

Installation

pip install nameko-sendgrid

Usage

from nameko.rpc import rpc
from nameko_sendgrid import SendGrid
from sendgrid.helpers.mail import *


class Service:
    name = "service"
    
    sendgrid = SendGrid()
    
    @rpc
    def send_email(self, address, body):
        from_email = Email("test@example.com")
        to_email = Email(address)
        subject = "Sending with SendGrid is Fun"
        content = Content("text/plain", body)
        message = Mail(from_email, subject, to_email, content)
        
        self.sendgrid.client.mail.send.post(message)

Specify your configuration like this:

SENDGRID_KEY: abcd

About

Sendgrid dependency provider for nameko services

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages