kami
kami

Reputation: 11

Delete email using mailinator API

I am creating application to access public emails in mailinator. I can view emails but I have difficulties when I am trying to delete them.

https://mailinator.com/apidocs.jsp all examples from documentacion worked except this one.

I have code to POST Http request:

        using (var client = new HttpClient())
        {
            var values = new Dictionary<string, string>
        {
           { "msgid", id}

        };

            var content = new FormUrlEncodedContent(values);

            var response = await client.PostAsync("https://api.mailinator.com/api/delete?", content);

            var responseString = await response.Content.ReadAsStringAsync();

}

Only error it throws is (405) Method Not Allowed. or Method is not supported by this URL.

So I guess either my url that I'm sending is bad, either my code.

I need some help to figure it out.

Upvotes: 0

Views: 1259

Answers (1)

Corey
Corey

Reputation: 16574

According to the API docs you need to pass a valid token with every call. The delete API example looks like this:

curl "https://api.mailinator.com/api/delete?id=1373143878-0-test22&token=..." 

The elipsis (...) there needs to be a valid token. So, add the token to your values dictionary.

Upvotes: 1

Related Questions