using System.Collections.Generic
using System.Linq
using System.Text
using CodeScales.Http
using CodeScales.Http.Entity
using CodeScales.Http.Entity.Mime
using CodeScales.Http.Methods
namespace SendcloudWebapi
{
public class Common
{
public static void send()
{
HttpClient client = new HttpClient()
HttpPost postMethod = new HttpPost(new Uri("http://sendcloud.sohu.com/webapi/mail.send.json"))
MultipartEntity multipartEntity = new MultipartEntity()
postMethod.Entity = multipartEntity
multipartEntity.AddBody(new StringBody(Encoding.UTF8, "api_user", "***")) # 使用api_user和api_key进行验证
multipartEntity.AddBody(new StringBody(Encoding.UTF8, "api_key", "***"))
multipartEntity.AddBody(new StringBody(Encoding.UTF8, "from", "sendcloud@sendcloud.org")) # 发信人,用正确邮件地址替代
multipartEntity.AddBody(new StringBody(Encoding.UTF8, "fromname", "SendCloud"))
multipartEntity.AddBody(new StringBody(Encoding.UTF8, "to", "to1@domain.comto2@domain.com")) # 收件人地址,用正确邮件地址替代,多个地址用''分隔
multipartEntity.AddBody(new StringBody(Encoding.UTF8, "subject", "SendCloud c# webapi example"))
multipartEntity.AddBody(new StringBody(Encoding.UTF8, "html", "
欢迎使用SendCloud
"))
HttpResponse response = client.Execute(postMethod)
Console.WriteLine("Response Code: " + response.ResponseCode)
Console.WriteLine("Response Content: " + EntityUtils.ToString(response.Entity))
}
}
}
<%Function RegTest(s,p)
Dim r
Set r =createobject("vbscript.regexp")
r.Pattern = p
r.IgnoreCase = True
r.Global = True
RegTest=r.test(s)
End Function
function decode(url,sertim)
dim decurl
dim length
dim keys
dim asc_arr1(123)
dim asc_arr2(123)
length=len(url)
keys=sertim mod 26
if keys<=0 then keys=1
for i=0 to 9
asc_arr1(i) = i + 48
asc_arr2(i + 48) = i
next
for i=10 to 35
asc_arr1(i) = i + 55
asc_arr2(i + 55) = i
next
for i=36 to 61
asc_arr1(i) = i + 61
asc_arr2(i + 61) = i
next
regstr="[A-Za-z0-9]"
for i=0 to length
word=replace((left(url,i+1)),(left(url,i)),"")
if (RegTest(word,regstr)) then
pos = asc_arr2(asc(replace((left(url,i+1)),(left(url,i)),""))) - keys
if pos <0 then pos = pos + 62
word = chr(asc_arr1(pos))
end if
decurl = decurl&word
next
decode=decurl
end function
str = "o00w://333.osq.z0h0z.nv2.ju/q5/4p14phuzopN1hun/44zn977D7A9F8G-7A.twA"
sertim = 1289225685
response.Write("<br>"&decode(str,sertim))
%>
先拿去用吧,测试过的了。注释的话就先不写了,有不懂的地方,再联系我吧,扣350-250-4-1-4。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)