arckinteractive / mailgun_mailin
将收到的电子邮件转换为新的网站内容
1.0.0
2016-08-18 12:46 UTC
Requires
- arckinteractive/mailgun: ~2.0
- composer/installers: ^1.0.8
This package is auto-updated.
Last update: 2024-08-29 03:57:24 UTC
README
允许用户通过发送电子邮件来发布新内容
支持新
- 博客
- 书签
- 文件
- 讨论
自定义
添加自定义解析器
要添加新的内容类型到支持的项中,为 'mailin:types','mailgun'
注册一个处理器,并将您的类型定义添加到列表中。类型定义包含一个可调用的处理器和允许的字段列表
elgg_register_plugin_hook_handler('mailin:types', 'mailgun', function($hook, $type, $return) { $return['event'] = [ 'handler' => 'my_mailin_event_parser', 'fields' => [ 'date', 'location', 'description', ], ]; }); function my_mailin_event_parser(\ArckInteractive\Mailgun\Message $message, $fields) { $date = strtotime($fields['date']); $location = $fields['location']; if (!$date || !$location) { return false; } // save the event // note that this will be performed via cron, so there is no logged in user // you will need to set ignored access after checking container/edit permissions return true; }
一旦设置,用户将看到设置中的事件类型,其中包含字段列表:设置 > 内容邮件入
用户可以发送以下格式的电子邮件
**Subject**
EVENT: Birthday party
**Message**
DATE: August 10, 2017 10:00
LOCATION: Some venue
DESCRIPTION:
I am hosting a birthday party, so come help me celebrate