mailersend / mailersend-python Goto Github PK
View Code? Open in Web Editor NEWThe official MailerSend Python SDK
Home Page: https://developers.mailersend.com
License: MIT License
The official MailerSend Python SDK
Home Page: https://developers.mailersend.com
License: MIT License
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
On email and bulk email endpoint setup
attachments.*.disposition
attachments.*.id
Describe alternatives you've considered
None
Additional context
None
A customer found a bug in our Python SDK:
Send in Bulk: https://github.com/mailersend/mailersend-python#send-bulk-email
Get bulk email status: https://github.com/mailersend/mailersend-python#get-bulk-email-status
from mailersend import emails
mailer = mailersend.NewEmail(api_key)
That doesn’t work because NewEmail is not a class from “mailersend” but from “emails”.
The correct should be:
from mailersend import emails
mailer = emails.NewEmail(api_key)
Reported by Cesar here.
We have a new parameter called "inbound_priority" on our Inbound Routes. This parameter allows our users to create multiple inbound routes per inbound subdomain. Each one of the routes will be processed in a descending order. Values can be between 0 and 100. 0 has more importance than 100.
As mentioned, pre-commit is currently in the dependencies.
Please use mailersend.com/contact-us for support questions. This repo should be kept for actual code bugs and/or improvements, and related issues.
Describe the bug
get_activity_by_date
method in Analytics
class does not return any data
To Reproduce
Steps to reproduce the behavior:
from mailersend import analytics
api_key = "xxxx"
mailer = analytics.NewAnalytics(api_key)
date_from = 1655382659
date_to = 1655641859
events = [
"processed",
"sent",
]
# optional arguments
group_by = "days"
x = mailer.get_activity_by_date(date_from, date_to, events)
print(x)
{"message":"The given data was invalid.","errors":{"date_from":["The date from field is required."],"date_to":["The date to field is required."],"event":["The event must be an array."]}}
Expected behavior
Function should return a JSON with appropriate data
Screenshots
None
Environment (please complete the following information):
Additional context
None
Is your feature request related to a problem? Please describe.
None
Describe the solution you'd like
We released personalisation values on our Send an SMS endpoint. Documentation is available here:
https://developers.mailersend.com/api/v1/sms.html#send-an-sms
Describe alternatives you've considered
None
Additional context
None
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
.github/workflows/publish.yaml
actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
JRubics/poetry-publish v1.17
pyproject.toml
poetry >=0.12
pyproject.toml
python ^3.7
requests ^2.25.0
setuptools ^68.0.0
pytest ^7.0
twine ^4.0.1
pre-commit ^2.12.1
Please add the following endpoints on the new Sender Identity section, below the Domains.
We have information on how to verify a signature in PHP but do not provide more code examples, please provide one and share here so we can publish it to the dev docs.
Describe the bug
get_domain_activity
method in the Activity class is sending dateFrom
and dateTo
instead of start_date
and end_date
.
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
We should be using start_date
and end_date
Screenshots
None
Environment (please complete the following information):
None
Additional context
None
Hi, the read me shows there's variable support but the latest published package on pypi.org is not having support for variables.
Thanks.
Hi there, I was wondering if the documentation for the package usage is accurate. I've the class receives the api_key, but it is no mentioned in the docs. Also, I'm curious on what were the reasons to use camelCase in a Python package. Coming from sendgrid, if things workout ok I could also contribute.
Edit: sorry, I missed the os.environ.get("MAILERSEND_API_KEY")
. Would it make sense to make it so that the api_key is a parameter, instead of necessarily having to use the env_var?
Is your feature request related to a problem? Please describe.
While adding a domain, only the name is allowed to pass. MailerSend's other language library as allowed to pass parameters in addition to the name such as custom_tracking_subdomain
etc.
Describe the solution you'd like
Allow all four parameters mentioned here while adding a domain.
Describe alternatives you've considered
One alternate I have considered is adding a domain and then updating those settings with the individual calls, but that will result in 4 calls to achieve this.
The bug/issue
Related to get_domain_activity, error is that i don't provide date_to and date_from even though i do provide them as you can see in the code below
To Reproduce
Steps to reproduce the behavior:
mailer = activity.NewActivity(api_key)
end_date = datetime.datetime.now()
start_date = end_date - datetime.timedelta(days=1)
#end_date=end_date.isoformat()
#start_date=start_date.isoformat()
end_date = int(end_date.timestamp())
start_date = int(start_date.timestamp())
events = [
"delivered",
]
sent_emails=mailer.get_domain_activity("my domain",limit=100,date_from=start_date, date_to=end_date, event=events)
sent_emails=json.loads(str(sent_emails))
Expected behavior
I have the list.
Environment (please complete the following information):
Please update the list of all webhook events in the documentation or any place where they are mentioned:
SOFT_BOUNCED = "activity.soft_bounced",
HARD_BOUNCED = "activity.hard_bounced",
OPENED = "activity.opened",
OPENED_UNIQUE = "activity.opened_unique",
CLICKED = "activity.clicked",
CLICKED_UNIQUE = "activity.clicked_unique",
UNSUBSCRIBED = "activity.unsubscribed",
SPAM_COMPLIANT = "activity.spam_complaint",
SURVEY_OPENED = "activity.survey_opened",
SURVEY_SUBMITTED = "activity.survey_submitted",
IDENTITY_VERIFIED = "sender_identity.verified",
MAINTENANCE_START = "maintenance.start",
MAINTENANCE_END = "maintenance.end",
the bug
Thanks for the cool library. I expect the response to be a python dictionary. Instead it is of type str that i need to convert using json.loads.
To Reproduce
Just use the function and print(type(response))
We recently added the in-reply-to option to the header.
Please include it in the SDK, under the Send an email endpoint. Documentation is here.
We added two parameters for our domains: ignore duplicated recipients and add a precedence bulk header. Both of these parameters have to be added to our related Domains endpoints.
As to better enforce security on our SDKs and avoid incidents, please avoid suggesting our users to set explicit declaration of the API/SMTP token in the code and instead suggest setting the API key as an environment variable.
neither
`from mailersend import emails
mailer = emails.NewEmail()
mailer.mailersend_api_key = 'eyJ0eXAiOiJKV1QiLCJ....xWbVag'
mail_body = {}
mail_from = {
"name": "Your Name",
"email": "[email protected]",
}
recipients = [
{
"name": "Your Client",
"email": "[email protected]",
}
]
mailer.set_mail_from(mail_from, mail_body)
mailer.set_mail_to(recipients, mail_body)
mailer.set_subject("Hello!", mail_body)
mailer.set_html_content("This is the HTML content", mail_body)
mailer.set_plaintext_content("This is the text content", mail_body)
print(mailer.send(mail_body))`
nor this
`from mailersend import emails
import os
os.environ['MAILERSEND_API_KEY'] = 'eyJ0eXAiOiJKV1QiLC...WbVag'
mailer = emails.NewEmail()
mail_body = {}
mail_from = {
"name": "Your Name",
"email": "[email protected]",
}
recipients = [
{
"name": "Your Client",
"email": "[email protected]",
}
]
mailer.set_mail_from(mail_from, mail_body)
mailer.set_mail_to(recipients, mail_body)
mailer.set_subject("Hello!", mail_body)
mailer.set_html_content("This is the HTML content", mail_body)
mailer.set_plaintext_content("This is the text content", mail_body)
print(mailer.send(mail_body))`
is working:
401 {"message":"Unauthenticated."}
The API-Key is OK, it works with Postman.
What´s wrong?
Attachments are currently not supported
Hello,
Is there anyway you could push the version on PyPI to include the "send template" functionality?
Thanks!
pip install mailersend
givesERROR: Could not find a version that satisfies the requirement mailersend (from versions: none)
ERROR: No matching distribution found for mailersend
3.7.8
21.1.2
There is a bug in the reply_to part of the README. It says:
reply_to = [
{
"name": "Name",
"email": "[email protected]",
}
]
but it should be without the brackets:
reply_to = {
"name": "Name",
"email": "[email protected]",
}
We should allow overriding base API url
https://github.com/mailersend/mailersend-go/blob/main/mailersend.go#L15
We recently changed activity fetch in our app so the pagination wasn’t working anymore for the API, could you update the Activity endpoint to match the most recent update?
Describe the bug
AttributeError: 'NewHelper' object has no attribute 'api_base'
To Reproduce
Initialize helper class and use it
helper = utils.NewHelper()
Expected behavior
It should have worked without error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.