{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import os\n", "from postmarker.core import PostmarkClient\n", "postmark = PostmarkClient(server_token=os.getenv(\"POSTMARK_API_KEY\"))" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'ErrorCode': 0,\n", " 'Message': 'OK',\n", " 'MessageID': 'fad620aa-dbcd-4435-9e93-3ee192c41dbb',\n", " 'SubmittedAt': '2024-09-03T09:58:55.9467739Z',\n", " 'To': 'leekwoon@unist.ac.kr'}" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import os\n", "from postmarker.core import PostmarkClient\n", "postmark = PostmarkClient(server_token=os.getenv(\"POSTMARK_API_KEY\"))\n", "\n", "subject = \"[kyobody - 자막생성] 작업이 완료되었습니다.\"\n", "body = \"[kyobody - 자막생성] 작업이 완료되었습니다.SRT 파일을 첨부하여 전달드립니다.\"\n", "\n", "postmark.emails.send(\n", " From='leekwoon@unist.ac.kr',\n", " To='leekwoon@unist.ac.kr',\n", " Subject=subject,\n", " HtmlBody=body\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'ErrorCode': 0,\n", " 'Message': 'OK',\n", " 'MessageID': '4a1f44e1-d0e8-4d3a-a50c-3b9a2e366fa0',\n", " 'SubmittedAt': '2024-09-03T10:46:41.7877421Z',\n", " 'To': 'leekwoon@unist.ac.kr'}" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import os\n", "from postmarker.core import PostmarkClient\n", "\n", "postmark = PostmarkClient(server_token=os.getenv(\"POSTMARK_API_KEY\"))\n", "\n", "subject = \"[kyobody - 자막생성] 작업이 완료되었습니다.\"\n", "body = \"[kyobody - 자막생성] 작업이 완료되었습니다.SRT 파일을 첨부하여 전달드립니다.\"\n", "\n", "# Specify the file path\n", "file_path = './README.md'\n", "\n", "# # Send the email with the attachment\n", "# postmark.emails.send(\n", "# From='leekwoon@unist.ac.kr',\n", "# To='leekwoon@unist.ac.kr',\n", "# Subject=subject,\n", "# HtmlBody=body,\n", "# )\n", "\n", "email = postmark.emails.Email(\n", " From='leekwoon@unist.ac.kr',\n", " To='leekwoon@unist.ac.kr',\n", " Subject='Postmark test',\n", " HtmlBody='
Hello dear Postmark user.'\n", ")\n", "email['X-Accept-Language'] = 'en-us, en'\n", "email.attach('./README.md')\n", "email.attach_binary(content=b'content', filename='readme.md')\n", "email.send()\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "kyobody", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.18" } }, "nbformat": 4, "nbformat_minor": 2 }