Site icon GetCodify

Integration sendinblue Transactional Email using Python

python logo

python logo

Sendinblue API can be used by platforms developed in various languages like PHP, Java, Node.js, Python, C# and Ruby.

Integration send in blue to your site Python

Before Starting If you want to know how to set up the send in blue dashboard before integration click link to know more:  How to Integrate Sendinblue Transactional Email

  1. Download the SendinBlue SMTP Library v2.0 from https://github.com/mailin-api/mailin-api-python.git
  2. Then you have to include mailing.py module.
  3. To install the mailin module you can run python setup.py install in the root of the distribution.
  4. then add below code to your project on python.
    from mailin import Mailin
    m = Mailin("https://api.sendinblue.com/v2.0","your access key")
	data = { "to" : {"to@example.net":"to whom!"},
		"from" : ["from@email.com", "from email!"],
		"subject" : "My subject",
		"html" : "This is the <h1>HTML</h1>",
		"attachment" : ["https://domain.com/path-to-file/filename1.pdf", "https://domain.com/path-to-file/filename2.jpg"]
	}

	result = m.send_email(data)
    print(result)

 

 

Exit mobile version