Send emails from a different address than authenticated to without setting 'mustMatchSender' to false

Your question

I want to send emails from address [email protected] while authenticated as [email protected].
The only settings I found that could do this is at SMTP AUTH Stage → Must match sender. But I don;t want to allow it for all. Can anyone point me to where I can find the syntax to write an exception ?

What I’m trying to achieve:
$mail->Username = ‘[email protected]’;
$mail->setFrom(‘[email protected]’, ‘NET’);

Expected outcome:
Mail delivered.

Current outcome:
The following From address failed: [email protected] : MAIL FROM command failed,You are not allowed to send from this address.

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

Add the exception as an expression on mustMatchSender under SMTP AUTH Stage settings, rather than disabling the check globally. The field is an Expression that can inspect the sender and authenticated_as variables, so you can allow a specific authenticated account to send as a specific alternate address while keeping the default true behavior for everyone else:

{
  "mustMatchSender": {
    "if": "authenticated_as == '[email protected]' && sender == '[email protected]'",
    "then": false,
    "else": true
  }
}

This evaluates to false (no match required, i.e. allowed) only for that specific authenticated user/sender pair, and falls back to true (must match) for everyone else. You could also add sender as an alias/email of the net-mbox account instead, which would satisfy the default mustMatchSender: true check without needing an exception at all, if that better fits your directory setup.

See the field reference: MtaStageAuth | Stalwart and the available variables: MtaMailFromVariable | Stalwart

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Yep, ai got it right this time.