MailGun给我错误代码400

时间:2017-04-15 10:30:57

标签: android android-volley mailgun

我想用mailGun和凌空发送一个eamil 这是我的代码:

ap params = new HashMap();
            params.put("from","Mailgun Sandbox <postmaster@sandbox3f4c3762bc4c4e528f114c47f02417b5.mailgun.org>");
            params.put("to",toEtxt.getText().toString());
            params.put("subject",subjectEtxt.getText().toString());
            params.put("text",msgEtxt.getText().toString());

            Map<String, String> headers = new HashMap<>();
            String credentials = "api:"+EndPoints.privateKey;
            String auth = "Basic "
                    + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
            headers.put("Authorization", auth);

            presenter.firePostRequest(params, headers, EndPoints.MailGunBase+EndPoints.MailApi);

然后我使用volley

发出请求
    public void PostRequest(final Map params, final Map headers, String url){
    request = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {
            Log.e("response",response);
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            Log.e("error",error+"");
        }
    }){
        @Override
        protected Map<String, String> getParams() throws AuthFailureError {
            return params;
        }

        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            return headers;
        }


    };

    VolleySingleton.getsInstance().getRequestQueue().add(request.setShouldCache(false));
}

任何人都可以说我错了吗? 我不知道我做错了什么,谢谢

这是我的错误:

  

“message”:“沙箱子域名仅用于测试目的。请在”帐户设置“中添加您自己的域名或将地址添加到授权收件人。”

0 个答案:

没有答案