I wanna send an eamil using mailGun and volley this is my code:
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);
and then I fire a request using 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));
}
can anyOne say what's my wrong ? I don't know where I did it wrong,Thanks
this is my error:
"message": "Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings."