首页 > 解决方案 > 如何通过电子邮件获取 API

问题描述

我想弄清楚如何用 python 给一个人发电子邮件,我想知道如何获取 api-key。

from socketlabs.injectionapi import SocketLabsClient
from socketlabs.injectionapi.message.bulkmessage import BulkMessage
from socketlabs.injectionapi.message.bulkrecipient import BulkRecipient
from socketlabs.injectionapi.message.emailaddress import EmailAddress

# Your SocketLabs ServerId and Injection API key
client = SocketLabsClient(10000, "YOUR-API-KEY");

message = BulkMessage()

message.plain_text_body = "This is the body of my message sent to %%Name%%"
message.html_body = "<html>This is the HtmlBody of my message sent to %%Name%%</html>"
message.subject = "Sending a test message"
message.from_email_address = EmailAddress("from@example.com")

有人可以告诉我如何获取 api-key 或它是什么吗?

标签: pythonpython-3.x

解决方案


您必须注册 socketlabs。然后只有您将获得用于发送自动电子邮件的 API 密钥。


推荐阅读