| Name | sendgrid-email JSON |
| Version |
0.0.5
JSON |
| download |
| home_page | None |
| Summary | Simple utility for sending emails via SendGrid. |
| upload_time | 2024-08-20 22:10:26 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.9 |
| license | None |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# sendgrid-email
This is a Python package that provides the function `send_email`:
def send_email(service_name, recipient, subject, html, attachments=[]):
sender = f"{service_name} <{SENDER_EMAIL_ADDRESS>"
msg = MIMEMultipart()
msg['From'] = sender
msg['To'] = recipient
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = subject
msg.attach(MIMEText(html, 'html'))
for attachment in attachments:
msg.attach(attachment)
# Send it off via smtp.sendgrid.net
with SMTP_SSL("smtp.sendgrid.net", 465) as smtp:
smtp.login("apikey", SENDGRID_API_KEY)
smtp.sendmail(sender, recipient, msg.as_string())
## Installation
pip install sendgrid-email
## Usage
from email.mime.application import MIMEApplication
from sendgrid_email import send_email
attachment = MIMEApplication(b"File contents", name="filename.txt")
attachment['Content-Disposition'] = 'attachment; filename="filename.txt"'
send_email(
"Example Service",
"recipient@example.org",
"Re: Example Subject",
"<h1>This is an example email</h1>",
[attachment],
)
Raw data
{
"_id": null,
"home_page": null,
"name": "sendgrid-email",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Mizuki Hikaru <mizuki@hikaru.org>",
"download_url": "https://files.pythonhosted.org/packages/cb/a6/b1b5470fe978021ec143c19ab17342738e504a0404cf400beb2f0986e633/sendgrid_email-0.0.5.tar.gz",
"platform": null,
"description": "# sendgrid-email\n\nThis is a Python package that provides the function `send_email`:\n\n def send_email(service_name, recipient, subject, html, attachments=[]):\n sender = f\"{service_name} <{SENDER_EMAIL_ADDRESS>\"\n\n msg = MIMEMultipart()\n msg['From'] = sender\n msg['To'] = recipient\n msg['Date'] = formatdate(localtime=True)\n msg['Subject'] = subject\n msg.attach(MIMEText(html, 'html'))\n for attachment in attachments:\n msg.attach(attachment)\n # Send it off via smtp.sendgrid.net\n with SMTP_SSL(\"smtp.sendgrid.net\", 465) as smtp:\n smtp.login(\"apikey\", SENDGRID_API_KEY)\n smtp.sendmail(sender, recipient, msg.as_string())\n\n## Installation\n\n pip install sendgrid-email\n\n## Usage\n\n from email.mime.application import MIMEApplication\n from sendgrid_email import send_email\n\n attachment = MIMEApplication(b\"File contents\", name=\"filename.txt\")\n attachment['Content-Disposition'] = 'attachment; filename=\"filename.txt\"'\n\n send_email(\n \"Example Service\",\n \"recipient@example.org\",\n \"Re: Example Subject\",\n \"<h1>This is an example email</h1>\",\n [attachment],\n )\n",
"bugtrack_url": null,
"license": null,
"summary": "Simple utility for sending emails via SendGrid.",
"version": "0.0.5",
"project_urls": {
"Homepage": "https://github.com/mizuki-hikaru/sendgrid-email",
"Issues": "https://github.com/mizuki-hikaru/sendgrid-email/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "712d93cb2bfd9cd2c92cf095a2ea605ae403852fc3762b247161cde30d4eb270",
"md5": "6ae1f97a23f15e5e73c17a8bf09778a4",
"sha256": "bc8ffb6a5b1fadb6fa4f588adcf6f745301342521a1811cb22b80ab545ecaa6e"
},
"downloads": -1,
"filename": "sendgrid_email-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6ae1f97a23f15e5e73c17a8bf09778a4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 3075,
"upload_time": "2024-08-20T22:10:25",
"upload_time_iso_8601": "2024-08-20T22:10:25.090366Z",
"url": "https://files.pythonhosted.org/packages/71/2d/93cb2bfd9cd2c92cf095a2ea605ae403852fc3762b247161cde30d4eb270/sendgrid_email-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cba6b1b5470fe978021ec143c19ab17342738e504a0404cf400beb2f0986e633",
"md5": "5cc6128c5b0063d471b31abc254fb863",
"sha256": "44c6c191ba6185bbe63ad012cb020885ec17dc02af9d0b3f698f174c820a184d"
},
"downloads": -1,
"filename": "sendgrid_email-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "5cc6128c5b0063d471b31abc254fb863",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 2149,
"upload_time": "2024-08-20T22:10:26",
"upload_time_iso_8601": "2024-08-20T22:10:26.761561Z",
"url": "https://files.pythonhosted.org/packages/cb/a6/b1b5470fe978021ec143c19ab17342738e504a0404cf400beb2f0986e633/sendgrid_email-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-20 22:10:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mizuki-hikaru",
"github_project": "sendgrid-email",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "sendgrid-email"
}