使用第三方服务发送消息
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
App Engine PHP 5 应用可以使用第三方公司提供的服务发送电子邮件、短信或接打电话。例如,您可以发送电子邮件确认业务交易、用户账号的创建,或者发送营销讯息。
本页面例举了一些公司,这些公司提供适用于 App Engine PHP 5 应用的通信服务和客户端库。
Mailjet
Mailjet 是全球电子邮件服务,它为 App Engine 用户提供免费配额。如需使用这项优惠,请点击以下链接创建 Mailjet 账号。
详细了解 Mailjet:
SendGrid
您可以使用 SendGrid 在 App Engine 上实现电子邮件功能。SendGrid 可以提高电子邮件递送能力,并让您清楚地了解应用发送的电子邮件的后续情况。借助 SendGrid 界面或其 API,您可以查看有关邮件打开、点击、退订、垃圾信息举报以及其他内容的统计信息。
App Engine 客户可以通过 Google Cloud 控制台注册加入 SendGrid Email API 计划来充分利用免费配额。请注意,Google 会向注册付费账号的客户收取费用。
详细了解 SendGrid:
通过 Twilio 使用短信和语音服务
通过 Twilio,您可以将语音、VoIP 和短信功能嵌入应用中。Twilio 平台由 Twilio 标记语言 (TwiML)、RESTful API 以及适用于网络浏览器、Android 和 iOS 的 VoIP SDK 组成。
详细了解 Twilio:
将客户端库和第三方 API 密钥添加到应用
如需在 App Engine 开发和部署环境中添加客户端库,请在应用的 composer.json
文件中将库指定为依赖项,并从应用的目录运行 composer install
。详细了解 Composer。
大多数第三方服务都会使用 API 密钥来对应用进行身份验证。您可以在第三方网站上生成密钥。如需在应用中使用这些密钥,我们建议您执行以下操作:
将密钥添加到应用的
app.yaml
文件中的环境变量部分。
例如:
env_variables:
EMAIL_API_KEY: key-from-third-party
在应用的代码中,通过环境变量检索该密钥。
根据第三方 API 的要求传递密钥。
请注意,有权访问 app.yaml
的人员也有权访问您的 API 密钥。如果您无法将 app.yaml
存储在一个安全位置,则我们建议您将 API 密钥存储在 Datastore 模式的 Firestore (Datastore) 等安全位置,然后在运行时检索这些密钥,或者将密钥保留在代码中,但使用 Cloud Key Management Service 等密钥库对其进行加密。如需了解每种方法的优点,请参阅选择密钥管理解决方案。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-06。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-06。"],[[["PHP 5 applications on App Engine can integrate third-party services for email, SMS, and voice communication, enhancing functionality like transaction confirmations and marketing."],["Mailjet and SendGrid are email service providers offering free quotas and APIs for App Engine users, with SendGrid also providing email deliverability tracking and analytics."],["Twilio enables voice, VoIP, and messaging capabilities within applications, using TwiML, a RESTful API, and SDKs for web, Android, and iOS."],["Client libraries are added to App Engine applications by specifying them in the `composer.json` file and running `composer install`, allowing the use of the third-party service."],["Third-party API keys, essential for app authentication, can be managed through environment variables in `app.yaml` or securely stored in services like Firestore or encrypted with Cloud Key Management Service."]]],[]]