ErrorCode":"400", "appErrorCode":"2301"

0 votes

Create a test script to send an email:

using com.shephertz.app42.paas.sdk.csharp;
using com.shephertz.app42.paas.sdk.csharp.email;
using UnityEngine;

public class enviaEmail : MonoBehaviour
{
    string sendSubject = "Here we are sending an Email";
    string sendMsg = "Body of message";

    string emailHost = "smtp.faciltecnologias.com.br";
    int emailPort = 587;
    string emailId = "financeiro@faciltecnologias.com.br";
    string password = "ale240471";
    bool isSSL = true;


    public void enviarEmail()
    {
        if (SingletonController.user != null)
        {

            EmailService emailService = SingletonController.serviceAPI.BuildEmailService();
            emailService.CreateMailConfiguration(emailHost, emailPort, emailId, password, isSSL, new UnityCallBack());
            emailService.SendMail(SingletonController.user.email, sendSubject, sendMsg, emailId, EmailMIME.PLAIN_TEXT_MIME_TYPE, new UnityCallBack());
        }
        else
        {
            print("Usuário inexistente!");
        }
    }

    class UnityCallBack : App42CallBack
    {

        public void OnSuccess(object response)
        {
            Email email = (Email)response;
            string jsonResponse = email.ToString();
            print(jsonResponse);
        }

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

However two messages are received: the first one informs about the ok setting for the email, but the sending of the email fails informing that the email already exists. Where does he exist? USER's email is another.

Messages Received on Unity3D Console:

{"app42":{"response":{"success":"true","email":{"from":"financeiro@faciltecnologias.com.br","to":"vendas@faciltecnologias.com.br","subject":"Here we are sending an Email","body":"Body of message"}}}}

 

Exception : com.shephertz.app42.paas.sdk.csharp.App42BadParameterException: {"httpErrorCode":"400", "appErrorCode":"2301", "message":"Bad Request", "details":"The request parameters are invalid. Email id 'financeiro@faciltecnologias.com.br' already exists."}

asked Dec 19, 2019 in Unity by alexandre (10 points)

1 Answer

0 votes
Hi Alexandre,

Greetings!!!

We have forwarded your query to our team, we will get back to you as soon as possible.

 

Regards,

Priyanka Singh

App42 Team
answered Dec 23, 2019 by anonymous
Hi Alexandre,

You need to call CreateMailConfiguration once only.

Please comment the below line from your code, it will work fine.

emailService.CreateMailConfiguration(emailHost, emailPort, emailId, password, isSSL, new UnityCallBack());
         
Also, to check the email configuration setting follow the below steps:
1. Login to AppHQ->Unified Notification->Setting->Emails

If you have any other concern please let us know, we will be happy to help you.

Regards,
Priyanka Singh
App42 Team
Thanks for the quick response. It worked.
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
...