2

I am trying to send a mail from Acumatica RestAPI by using the below API URL:

https:/{url}/entity/Default/17.200.001/Email?CompanyID=STS&ScreenID=CR306015

The problem am facing while calling this API with the request shown here:

{
    "From":
            {
            "value":"abc.service@abc.com"
            },

            "To":
            {
                "value":"example@abc.com"
            },
            "Subject":
            {
                "value":"Test Email"
            },
            "Body":
            {
                "value":"Sample Erp Bot Mail Check"
            }

    }

Is the mail is getting saved into Drafts rather than saving into sent(not being sent to receipt).

The response I am getting when calling the RestAPI is:

(Response from Postman Status:200 OK)

 "MailStatus": {
        "value": "Draft"
    }

Please suggest a way to send email through Acumatica [RestAPI] using C# and .NET.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

To do that you need to actually perform 2 API calls:

  1. Create email (as you do right now)
  2. Execute send action.

To execute Send action you do the following request:

POST: https://{url}/entity/Default/17.200.001/Email/SendEmail
Body: 
{
  "entity":
   {
     "id": "put yor email ID here that you get as a result of email creation"
   }
}

For optimization purpose you can combine both requests into one like that:

POST: https://{url}/entity/Default/17.200.001/Email/SendEmail
Body: 
{
  "entity":
   {
     {
        "From":
        {
        "value":"abc.service@abc.com"
        },

        "To":
        {
            "value":"example@abc.com"
        },
        "Subject":
        {
            "value":"Test Email"
        },
        "Body":
        {
            "value":"Sample Erp Bot Mail Check"
        }
    }  
  }
}
Dmitrii Naumov
  • 1,692
  • 8
  • 17