Create a receive rule
/v1/email/mailboxes/{mailbox_id}/receive-rulesconst rule = await bird.email.mailboxes.receiveRules.create("mbx_01abc", {
action: "block",
entry: "spam.example.com",
});
console.log(rule.id);rule = client.email.mailboxes.receive_rules.create(
"mbx_01krdgeqcxet5s7t44vh8rt9mg", action="block", entry="spam.example.com"
)
print(rule.id)rule, err := client.Email.Mailboxes.ReceiveRules.Create(context.Background(), "mbx_123", bird.EmailMailboxesReceiveRulesCreateParams{
Action: "block",
Entry: "spam.example.com",
})
if err != nil {
log.Fatal(err)
}
fmt.Println(rule.Id)$rule = $bird->email->mailboxes->receiveRules->create(
'mbx_01krdgeqcxet5s7t44vh8rt9mg',
(new ReceiveRuleCreate())
->setAction('block')
->setEntry('spam@example.com')
->setNote('Repeated spam'),
);
echo $rule->getId();bird email mailboxes receive-rules create <mailbox-id> \
--action allow \
--entry partner.example.com \
--note 'Approved partner senders'curl -X POST "https://us1.platform.bird.com/v1/email/mailboxes/{mailbox_id}/receive-rules" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"action": "allow",
"entry": "partner.example.com",
"note": "Approved partner senders"
}'{
"id": "erl_01krdgeqcxet5s7t44vh8rt9mg",
"mailbox_id": "mbx_01krdgeqcxet5s7t44vh8rt9mg",
"action": "allow",
"entry": "partner.example.com",
"entry_type": "address"
}
Adds an allow or block rule to the mailbox. Rules match the message's envelope sender. Domain entries also match subdomains. Block rules always win, both over allow rules and over the reply admission on allowlist mailboxes. An entry is either allow or block. Rules have no update operation, so a rule that needs the other action is a new rule and the old one is removed. A mailbox holds up to 200 rules.
Parameters
mailbox_idstringMailbox identifier. Starts with mbx_.
Request Payload
actionWhat the rule does when it matches. Block rules always win. To flip an entry's action, delete the existing rule and re-create it.
Possible values: allow, block
entryThe sender address (alice@example.com) or domain (example.com) to match. Domains also match their subdomains. Stored lowercase.
noteYour own note about why the rule exists.
Response Payload
idIdentifies this rule for deletion. There is no update operation.
mailbox_idThe mailbox the rule applies to.
actionWhat the rule does when it matches. Block rules always win: over allow rules and over the reply admission on allowlist mailboxes.
Possible values: allow, block
entryThe sender address or domain the rule matches. Domains also match their subdomains.
entry_typeWhether the entry is a full address or a domain.
Possible values: address, domain
noteYour own note about why the rule exists. null when unset.
created_atWhen the rule was created.
Related resources
Continue with the documentation, guides and examples for this topic.