public static RestResponse SendSimpleMessage () {
RestClient client=new RestClient ();
Client. BaseUrl="https://api.mailgun.net/v2";
Client. The Authenticator=new HttpBasicAuthenticator (
"API", "key - 3 ax6xnjp29jd6fds4gc373sgvjxteol0");
RestRequest request=new RestRequest ();
Request. AddParameter (" domain ",
"Samples.mailgun.org", ParameterType. UrlSegment);
Request. The Resource="{domain}/messages";
Request. AddParameter (" from ", "Excited User & lt; [email protected] & gt;" );
Request. AddParameter (" to ", "[email protected]");
Request. AddParameter (" subject ", "Hello");
Request. AddParameter (" text ", "Testing some Mailgun awesomness!" );
Request. The Method=Method. The POST;
Return the client. The Execute (request);
}
CodePudding user response:
Idhttp. Post.CodePudding user response:
http://www.delphitop.com/html/kongjian/542.html