python - 如何通过电子邮件获取 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 或它是什么吗?
解决方案
您必须注册 socketlabs。然后只有您将获得用于发送自动电子邮件的 API 密钥。
推荐阅读
- scala - 在另一种方法中使用无形多边形
- mysql - 未选择数据库 MySQL 数据库连接到 VS 2017 社区版 (vb.net)
- knex.js - bookshelf.js - where 条件下的嵌套语句
- uber-api - Uber API 令牌突然不再工作
- javascript - 如何根据javascript中的最大值从对象数组中删除一个对象
- apache-kafka - 不能将kafka用于python
- android - 在android中画一个彩虹色的环
- java - 如何为 iText 中的 PatternColor 填充定义偏移量?
- sql - 非常庞大的数据避免分析功能
- mongodb - 将 DISTINCT 应用于 MongoDB 结果