Created
February 20, 2015 05:58
-
-
Save jyukutyo/044a5cb579e86f16ad8d to your computer and use it in GitHub Desktop.
post mail body by http request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Const BOT_URL = "http://example.com" | |
Public Sub Run(Item As Outlook.MailItem) | |
Say (Item.Body) | |
End Sub | |
'================================================== | |
'UrlEncodeUtf8: 文字列をUTF-8でエンコードするFunction | |
'================================================== | |
'strSource: 元の文字列 | |
'返り値: エンコードされた文字列 | |
'================================================== | |
Public Function UrlEncodeUtf8(ByRef strSource As String) As String | |
Dim objSC As Object | |
Set objSC = CreateObject("ScriptControl") | |
objSC.Language = "Jscript" | |
UrlEncodeUtf8 = objSC.CodeObject.encodeURIComponent(strSource) | |
Set objSC = Nothing | |
End Function | |
Sub Say(Body As String) | |
Dim xhr | |
Dim RequestURL As String | |
Dim Message As String | |
Message = Body | |
RequestURL = BOT_URL & "?m=" & UrlEncodeUtf8(Message) | |
Set xhr = CreateObject("Microsoft.XMLHTTP") | |
xhr.Open "GET", RequestURL, False | |
xhr.Send | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment