Envelop

The SMTP envelop can be mutated by several function from this module.

fn add_rcpt_envelop(rcpt)

Add a new recipient to the envelop. Note that this does not add the recipient to the `To` header. Use `add_rcpt_message` for that.

Args

  • rcpt - the new recipient to add.

Effective smtp stage

All of them.

Example

#{
    connect: [
       // always deliver a copy of the message to "john.doe@example.com".
       action "rewrite envelop" || add_rcpt_envelop("john.doe@example.com"),
    ]
}


fn bcc(rcpt)

Add a recipient as a blind carbon copy. The equivalent of `add_rcpt_envelop`.

Args

  • rcpt - the recipient to add as a blind carbon copy.

Effective smtp stage

All of them.

Example

#{
    connect: [
       // set "john.doe@example.com" as a blind carbon copy.
       action "bcc" || bcc("john.doe@example.com"),
    ]
}


fn remove_rcpt_envelop(rcpt)

Remove a recipient from the envelop. Note that this does not remove the recipient from the `To` header. Use `remove_rcpt_message` for that.

Args

  • rcpt - the recipient to remove.

Effective smtp stage

All of them.

Example

#{
    preq: [
       // never deliver to "john.doe@example.com".
       action "rewrite envelop" || remove_rcpt_envelop("john.doe@example.com"),
    ]
}


fn rewrite_mail_from(new_addr)

Rewrite the value of the `MAIL FROM` command has well has the `From` header.

Args

  • new_addr - the new sender address to set.

Effective smtp stage

preq and onwards.

Example

#{
    preq: [
       action "rewrite sender" || rewrite_mail_from("john.doe@example.com"),
    ]
}


fn rewrite_mail_from_envelop(new_addr)

Rewrite the sender received from the `MAIL FROM` command.

Args

  • new_addr - the new sender address to set.

Effective smtp stage

mail and onwards.

Example

#{
    preq: [
       action "rewrite envelop" || rewrite_mail_from_envelop("unknown@example.com"),
    ]
}


fn rewrite_rcpt_envelop(old_addr, new_addr)

Replace a recipient received by a `RCPT TO` command.

Args

  • old_addr - the recipient to replace.
  • new_addr - the new address to use when replacing old_addr.

Effective smtp stage

rcpt and onwards.

Example

#{
    preq: [
       action "rewrite envelop" || rewrite_rcpt_envelop("john.doe@example.com", "john.main@example.com"),
    ]
}