Configure Email: the request parameters are invalid

0 votes

Hello, I want to configure the email, but I got this error:

errorValue : {"app42Fault" : {"httpErrorCode":400,"appErrorCode":1400,"message":"Bad Request","details":"The Request Parameters are invalid"}}

here is the code :

using UnityEngine;
using System.Collections;
using com.shephertz.app42.paas.sdk.csharp;
using com.shephertz.app42.paas.sdk.csharp.email;
using UnityEngine.UI;

public class App42EmailConfig : MonoBehaviour {
    private const string apiKey = "78e127a04f3fba734e42bd76dbd6cc0e3d2dca95b9a110d10a86e2d7877f4993";
    private const string secretKey = "7a7ee19b94644eb0a230b2c6527a7669a7fe83ac62bf63ff36ba32d2b607db0b";

    string emailHost = "smtp.gmail.com";
    int emailPort = 465;
    string emailId = "ecxitegamer@gmail.com";
    string password = "**********";
    bool isSSL = true;

    EmailService emailService = App42API.BuildEmailService();

    public void EmailConfigButton()
    {
        emailService.CreateMailConfiguration(emailHost, emailPort, emailId, password, isSSL, new EmailCallBack());
        App42Log.SetDebug(true);
    }
               
    // Use this for initialization
    void Start () {
        ServiceAPI serviceAPI = new ServiceAPI(apiKey, secretKey);
    }
	
	// Update is called once per frame
	void Update () {
        if (Input.GetKeyDown(KeyCode.Return))
        {
            EmailConfigButton();
        }
    }
}

public class EmailCallBack : App42CallBack
{
    public void OnSuccess(object response)
    {
        App42Log.Console("Success : " + response);
    }

    public void OnException(System.Exception e)
    {
        App42Log.Console("Exception : " + e);
    }
}

I don't understand about this error. I hope you can find the solution.

Thanks for help.

asked Sep 19, 2016 in Unity by Andre Setiawan (10 points)

1 Answer

0 votes

Hi Andre,

 

Greetings!

 

Thanks for sharing the code snippet with us. The error which you are getting is because of you are setting the app credentials in ServiceAPI instance and calling the service using App42API instance. So I would suggest you to replace the below code:

From

ServiceAPI serviceAPI = new ServiceAPI(apiKey, secretKey);

to

App42API.Initialize(apiKey,secretKey);
 

Let me know if you still face the same issue.

 

Regards,

Himanshu Sharma

answered Sep 20, 2016 by hs00105 (2,005 points)
Didn't work. I have changed the code, but I still faced the same issue.
Hi,

Could you please place the following statement just after initialising App42API in start method:

EmailService emailService = App42API.BuildEmailService();

If you need emailService as global variable then you declare it above at its current position but create its instance at the place i suggested above.

If this is still not working then please share the modified code.

Regards,
Rajeev
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...