Skip to content

Recall mail

Call RevokeMailAsync() to recall mail that has already been sent. Check the MailId of the sent mail, and if needed, retrieve the status again after the recall request to check whether it has changed to Revoked.

1. Check the identifier of the mail to recall

A recall request needs MailId, the sent mail identifier. You can use the MailId you saved when sending as is. If you need to check the latest status and the expiration time together to confirm that this is the right mail to recall, check again with Get sent mail.

Check the MailId

The value used for recall is the MailId of the sent mail. It is a different value from the MailRecipientId of received mail, so be careful not to confuse them.

2. Request a mail recall

Method

RevokeMailAsync

When you call RevokeMailAsync(), the request is accepted and the sent mail status immediately changes to Revoked.

The recall of received mail is processed asynchronously. Mail that has already been marked as read or whose attached item claim status has been reflected is not recalled.

Call parameters

Field name Type Required Description
request RevokeMailRequest Required Request that specifies the mail to recall
context ApiCallContext? Optional Per-call settings object. If omitted, the default values are used.

RevokeMailRequest

Field name Type Required Description
MailId string Required Identifier of the sent mail to recall

Call example

See the example below and the response status for the success result of MailboxRevokeMailResult and the domain-specific results (Outcome) of this method. For the result model and handling principles of common failures (Failure) returned when the request cannot be performed, see Common error handling.

using Hive.Axyl.Mailbox;
using Hive.Axyl.Core;

IMailboxService mailbox = HiveCore.Resolve<IMailboxService>();

var result = await mailbox.RevokeMailAsync(new RevokeMailRequest {
    MailId = storedMailId,
});

switch (result)
{
    case MailboxRevokeMailResult.Success success:
        AcceptedResponseData data = success.Data;
        Debug.Log($"Recall accepted: {data.MailId} (accepted at: {data.AcceptedAt})");
        break;

    case MailboxRevokeMailResult.Failure failure:
        HiveError err = failure.Problem;
        Debug.LogError($"[{err.Code}] {err.Message} (trace: {err.TraceId})");
        break;

    default:
        Debug.LogWarning($"Unhandled result: {result.GetType().Name}");
        break;
}

Response data

On success, the result is contained in Data (AcceptedResponseData) of MailboxRevokeMailResult.Success. Like sending, a recall request is also returned in the form of an asynchronous acceptance.

Both fields are declared with types that can hold null, so check whether a value is null before you show it on the screen or pass it to the next call.

Field name Type Required Description
Data.MailId string? Optional Identifier of the mail for which the recall request was accepted
Data.AcceptedAt DateTimeOffset? Optional Time when the recall request was accepted

Response example

// success.Data (AcceptedResponseData)
string? mailId = success.Data.MailId;
DateTimeOffset? acceptedAt = success.Data.AcceptedAt;

Response status

The returned object MailboxRevokeMailResult branches into one of the cases below. We recommend handling it with a switch statement.

Response case Description App client handling
Success The recall request was accepted. The sent mail immediately changes to Revoked, and the recall of received mail is processed asynchronously. Notify that the recall was accepted, and then retrieve the status again if needed
Failure Common Failure. See Common error handling. Handle according to the common error handling criteria
UnknownOutcome A new result that this SDK version does not recognize. Treat it as a failure and record the result code

3. Retrieve the status again after the recall

To check whether the sent mail status has changed to Revoked, run Get sent mail again with the same MailId. When the recall is reflected on the recipient side, the received mail disappears from the Get the received mail list results. If your app also shows the recipient's screen, we recommend retrieving the list again to refresh the mailbox UI. Recalled mail is automatically and permanently deleted (HARD DELETE) after 90 days, even if you do not call Delete sent mail separately.