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

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.

主站蜘蛛池模板: 磐安县| 陆良县| 东乌珠穆沁旗| 沙田区| 襄垣县| 平山县| 永修县| 永仁县| 南靖县| 石棉县| 仁布县| 涟水县| 嘉义县| 伊金霍洛旗| 新宁县| 金山区| 广安市| 什邡市| 松潘县| 湟源县| 乌审旗| 密山市| 金门县| 双辽市| 原平市| 鄢陵县| 宜丰县| 扬州市| 聂拉木县| 威远县| 商城县| 旌德县| 霍州市| 蒙自县| 唐河县| 昌乐县| 安泽县| 鹤峰县| 和顺县| 泰来县| 容城县|