GithubHelp home page GithubHelp logo

elasticemail / elasticemail.webapiclient-python Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 5.0 122 KB

Easily send emails with Elastic Email using Web API Python Client https://elasticemail.com/

License: MIT License

Python 100.00%
elastic email elasticemail python web api transactional

elasticemail.webapiclient-python's People

Contributors

eeppodolak avatar ppodolak avatar radzawee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

elasticemail.webapiclient-python's Issues

ElasticEmailClient.py must be updated

When a post request is made using the current ElasticEmailClient.py file, it sends data as the url parameter. In the link given in the "Python Api Integration Library" article, the data is sent with the data parameter in the ElasticEmailClient.py file.
(Article: https://elasticemail.com/api-documentation/integration-libraries/introduction-to-our-python-api-integration-library)
(ElasticEmailClient.py link: http://api.elasticemail.com/public/client/python)
ElasticEmailClient
(photo: Comparison of ElasticEmailClient.py file in Github and Article)

I've tried to send email using the bodyHtml parameter. While sending the mail using ElasticEmailClient.py file in Github, i got this error:
ElasticEmailClientError

By debugging, The result field in the Request method in the ApiClient class in the ElasticEmailClient.py file.
ElasticEmailClientResult

The problem is that it sends the data as a url parameter. The file in the article has resolved the problem. The file ElasticEmailClient.py, which is given as a link in the article, must also be added here.

Merge does not send variables to API properly

Summary

Using current version of ElasticEmailWebApiClient on PyPI, it seems like merge tags are not getting translated to the correct format required by the V2 API. I confirmed this locally and I have some sample code that exhibits this behavior.

Setup Steps

  • You have the latest published version: pip install ElasticEmailWebApiClient==1.0.5
  • Ensure you have set ELASTIC_EMAIL_API_KEY as an environmental variable.
  • Create a template and replace the template_id with the one from ElasticEmail.
  • Ensure you have a template in ElasticEmail with {inviter} and {invite_url}.

Repo Steps

import os
from ElasticEmailClient import ApiClient, Email

ApiClient.apiKey = os.getenv('ELASTIC_EMAIL_API_KEY')
template_id = '58095'
to_email = '[email protected]'
inviter_email = '[email protected]'
invite_url = 'https://www.google.com'

Email.Send(to=[to_email],
               template=template_id,
               merge={'merge_inviter': inviter_email, 'merge_invite_url': invite_url},
               isTransactional=True)

Actual behavior

Email sends, but does NOT replace merge variables.

Expected behavior

Email sends, but replaces merge variables.

Root Cause

It appears that other ElasticEmail libraries for other languages specifically break out "merge" and it put in the correct URL parameters. See your PHP library for example

It actually looks like this repository has a call to fix this, but this function is missing in the published version on PyPI. See this line in ElasticEmailClient.py and compare that with the code you download from PyPI for ElasticEmailWebApiClient

Also it actually looks like the repository is out of sync from PyPI. Can you please submit the latest version for this library to PyPI?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.