Skip to main content
MFARRAG
Staff
Staff
September 4, 2024

Technical Tip: Releasing System-Quarantined Emails via FortiMail API

Description

This article describes step-by-step instructions on how to release emails from the system quarantine on FortiMail using the API.

Scope FortiMail.
Solution
  1. Enable REST API on FortiMail.

By default, the REST API is disabled on FortiMail. To enable it, use the following commands:

 

config system web-service

    set rest-api-status enable

end

 

  1. Authenticate Using Postman.

    Use the Postman tool to interact with the FortiMail API. First, authenticate by sending a POST request to the following endpoint:


    curl -v -H "Content-Type: application/json" -X POST -d '{"name":"admin","password":""}'

    https://10.5.27.242/api/v1/AdminLogin

    -c cookie.txt

     

    Replace 'your password' with the actual admin password.

    Replace 'name' with the actual admin username.

     

     

  2. Retrieve Quarantined Emails.
    To view the system-quarantined emails in the 'Bulk' folder, send a request to the following endpoint.

    Run https://10.5.27.242/api/v1/QuarantineMailDisplay.

    Include the following parameters in the request body:

    {"reqAction":1,"type":"system","folder":"Bulk","startindex":"0","pageSize":"50"}

    API-TEST1.PNG

    This request will return the quarantined messages in the 'Bulk' folder. Note the MMKEY from the response, which will look similar to the following '1725455146.2441_128630_846749.011323#Q#484D5fff002991'.

     

  3. Release Quarantined Email.
    To release a specific email from quarantine, send a POST request to the following endpoint:

    https://10.5.27.242/api/v1/SystemQuarantineRelease

    Include the following parameters in the request body:

    {

      "folder": "Bulk",

      "mmkey": "1725455146.2441_128630_846749.011323#Q#484D5fff002991",

      "otherEmails": "",

      "reqAction": 7

    }

    API-TEST2.PNG

     

  4. Verification.
    After executing the release command, check the 'System Quarantine' section in FortiMail to ensure that the email has been successfully released.
                                                   

    released-api1.PNG

    released2.PNG

    Thought Leadership. Security Summit. Thursday, November 12th, PGA National Resort, Palm Beach Gardens, FL.
    Thought Leadership. Security Summit. Thursday, October 8th. Disney's Grand Californian Hotel & SPA, Anaheim, CA.
    Security Operations Summit: Modernize SecOps. Operate AI-Native.AMER: November 4 | 9:00 AM PST. India and SAARC: November 5 | 10:00 AM IST. EMEA: November 5 | 10:30 AM CET. APAC: November 5 | 11:00 AM SGT