JSONでメール送信
@azumakuniyuki Cubicroot Co. Ltd.
YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土)
HTTP API Server ``Haineko''
Send...
@azumakuniyuki
- あずま(猫)@京都
- サーバ管理者(*BSD,Linux)
- プログラマ(Perl,C,R,/bin/sh)
- Azuma, Kuniyuki
- From Kyoto, Japan.
- Server ...
作ったもの Modules
- bounceHammer
- バウンスメール解析する / bounce mail parser
- YAML/JSONで出る / Output in JSON, YAML
- http://bouncehamme...
JSONでメール送信
Sending email in JSON via HTTP
HTTP API Server ``Haineko''
YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土)
``Haine...
Haineko``はいねこ''
/haineko/
YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土)
``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd.
5
- リレーサーバ(JSON/HTTPでの入出力)
- 別のSMTPサーバにメールをリレー
- is a relay server for sending email
- receives an email in JSON via HTTP
- ...
HTTP
API
INTO
ESMTP
K=undef
O=undef
YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土)
``Haineko'' @azumakuniyuki / Cubicroot Co...
Architecture
Hainekoの処理の流れ、全体図と部分図。
YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土)
``Haineko'' @azumakuniyuki / Cubicroot Co...
Haineko Flow
Haineko
HTTP Request
HTTP Request
ESMTP Relay
Email Cloud
SendGrid
AmazonSES
Postmark(まだ)
MailChimp(まだ)
HTTP ...
Sending & Reply
メール送信とJSONでの応答
YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土)
``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd...
$ git clone https://github.com/azumakuniyuki/
Haineko.git
...
$ cd ./Haineko
$ plackup -I./lib -p 2794 -a libexec/haineko....
$ curl 'http://127.0.0.1:2794/submit'
-X POST
-H 'Content-Type: application/json'
-d '{ ehlo: "ホスト名",
mail: "neko@example....
{
"smtp.queueid":"r6DCXsV00649aTl2",
"smtp.response": {
"dsn": "2.0.0",
"error": 0,
"message":[ "Accept for delivery" ],
"...
{
"smtp.queueid":"r6DCXsV00649aTl2",
"smtp.response": {
"dsn": "5.7.1",
"error":1,
"message":[ "Recipient address not perm...
Repository
github.com/azumakuniyuki/Haineko
YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土)
``Haineko'' @azumakuniyuki / Cubi...
終
16
Upcoming SlideShare
Loading in …5
×

JSONでメール送信 | HTTP API Server ``Haineko''/YAPC::Asia Tokyo 2013 LT Day2

997
-1

Published on

YAPC::Asia Tokyo 2013 LT Day2で発表したHainekoの概略

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
997
On Slideshare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

JSONでメール送信 | HTTP API Server ``Haineko''/YAPC::Asia Tokyo 2013 LT Day2

  1. 1. JSONでメール送信 @azumakuniyuki Cubicroot Co. Ltd. YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) HTTP API Server ``Haineko'' Sending email in JSON via HTTP
  2. 2. @azumakuniyuki - あずま(猫)@京都 - サーバ管理者(*BSD,Linux) - プログラマ(Perl,C,R,/bin/sh) - Azuma, Kuniyuki - From Kyoto, Japan. - Server Administrator(*BSD,Linux) - Programmer(Perl,C,R,/bin/sh) YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 2
  3. 3. 作ったもの Modules - bounceHammer - バウンスメール解析する / bounce mail parser - YAML/JSONで出る / Output in JSON, YAML - http://bouncehammer.jp/ - Acme::Nyaa - 初CPANモジュール/猫系 - 神と和解せよ => ネコと和解せよ - 祇園祭です => 祇園祭ですニャー - Convert text like which a cat is talking - in Japanese YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 3
  4. 4. JSONでメール送信 Sending email in JSON via HTTP HTTP API Server ``Haineko'' YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 4
  5. 5. Haineko``はいねこ'' /haineko/ YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 5
  6. 6. - リレーサーバ(JSON/HTTPでの入出力) - 別のSMTPサーバにメールをリレー - is a relay server for sending email - receives an email in JSON via HTTP - relays an email to external SMTP host - responds in JSON - is a PSGI application Haineko ? YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 6
  7. 7. HTTP API INTO ESMTP K=undef O=undef YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 7
  8. 8. Architecture Hainekoの処理の流れ、全体図と部分図。 YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 8
  9. 9. Haineko Flow Haineko HTTP Request HTTP Request ESMTP Relay Email Cloud SendGrid AmazonSES Postmark(まだ) MailChimp(まだ) HTTP Listen on 2794 HTTP Response ESMTP Response HTTP Response POST HTTP CLIENT Browser / wget / curl to JSON Any SMTP Server smtp.example.jp:25 tls.example.com:465 smtp.gmail.com:587 Another Haineko Server SMTP HTTP / HTTPS SMTP-AUTH STARTTLS PIPELINING JSON JSON YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 9
  10. 10. Sending & Reply メール送信とJSONでの応答 YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 10
  11. 11. $ git clone https://github.com/azumakuniyuki/ Haineko.git ... $ cd ./Haineko $ plackup -I./lib -p 2794 -a libexec/haineko.psgi HTTP::Server::PSGI: Accepting connections at http://0:2794/ Start Haineko YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 11
  12. 12. $ curl 'http://127.0.0.1:2794/submit' -X POST -H 'Content-Type: application/json' -d '{ ehlo: "ホスト名", mail: "neko@example.jp", rcpt: [ "kijitora@example.org", "mikeneko@example.com" ], body: "ネコと和解せよ", header: { subject: "ニャー!!", … } }' HTTP POST YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 12
  13. 13. { "smtp.queueid":"r6DCXsV00649aTl2", "smtp.response": { "dsn": "2.0.0", "error": 0, "message":[ "Accept for delivery" ], "command": "QUIT", "code": "221" }, "smtp.useragent": "ユーザエージェント(USER_AGENT)", "smtp.recipient": [ "kijitora@example.jp"], "smtp.addresser": "NNN@example.org", "smtp.remotehost": "127.0.0.1", "smtp.remoteport":49989 } 200 OK YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 13
  14. 14. { "smtp.queueid":"r6DCXsV00649aTl2", "smtp.response": { "dsn": "5.7.1", "error":1, "message":[ "Recipient address not permitted" ], "command": "RCPT", "code": "533" }, "smtp.useragent": "ユーザエージェント(USER_AGENT)", "smtp.recipient": [ "kijitora@example.gov"], "smtp.addresser": "NNN@example.org", "smtp.remotehost": "127.0.0.1", "smtp.remoteport":49989 } 5xx OR 4xx YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 14
  15. 15. Repository github.com/azumakuniyuki/Haineko YAPC::Asia Tokyo 2013 LT Day 2 2013/09/21(土) ``Haineko'' @azumakuniyuki / Cubicroot Co. Ltd. 15
  16. 16. 終 16

×