官术网_书友最值得收藏!

Custom mail plugins

In the preceding section, we saw how we can use the Drupal 8 mail API to send emails programmatically in Drupal 8. In doing so, we used the default PHP mailer, which although is good enough for our example, might not be so for our application. For example, we might want to use an external service via an API.

In this section, we will teach you how to do this. To this end, we will need to write our own mail plugin that does just that, and then simply tell Drupal to use that system instead of the default one. Yet another plugin-based, noninvasive, extension point.

Before we start, I would like to mention that we won't go into any kind of detail related to the potential external API. Instead, we will stop at the Drupal 8-specific parts, so the code you will find in the repository won't do much--it will be used as an example only. It's up to you to use this technique if you need to.

主站蜘蛛池模板: 镇坪县| 阿坝县| 麟游县| 宝兴县| 沁水县| 双流县| 合肥市| 永平县| 突泉县| 武城县| 安西县| 墨脱县| 潼南县| 临夏县| 青阳县| 宁远县| 武穴市| 华蓥市| 偃师市| 靖江市| 连云港市| 华宁县| 永泰县| 贞丰县| 鄢陵县| 新巴尔虎左旗| 湖南省| 昌乐县| 礼泉县| 四平市| 开远市| 石家庄市| 梓潼县| 抚顺县| 安溪县| 吉林市| 万宁市| 莱阳市| 伽师县| 舒兰市| 集安市|