This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| reference:outgoing_message_script [2015/02/10 10:23] – [Outgoing Message Scripting] paul | reference:outgoing_message_script [2024/03/21 10:49] (current) – paul | ||
|---|---|---|---|
| Line 23: | Line 23: | ||
| * HoldSeconds - The current number of seconds the message will be held before being sent (0 = no time). | * HoldSeconds - The current number of seconds the message will be held before being sent (0 = no time). | ||
| * DeleteAfterSeconds - The current number of seconds before the message will be deleted from the queue (0 = never). | * DeleteAfterSeconds - The current number of seconds before the message will be deleted from the queue (0 = never). | ||
| + | * HoldTimeFromSender - The ISO-8601 time to hold to as defined at message send time (eg by ' | ||
| + | * DeleteTimeFromSender - The ISO-8601 time to delete the message at as defined at message send time (added in v8.6) | ||
| The function returns a table of new settings. This can contain the following fields. If the field doesn' | The function returns a table of new settings. This can contain the following fields. If the field doesn' | ||
| Line 30: | Line 32: | ||
| * HoldUntil - If this is set to a string like YYYYMMDDHHMMSS then the message is held until that time, otherwise it is held for the specified number of seconds. | * HoldUntil - If this is set to a string like YYYYMMDDHHMMSS then the message is held until that time, otherwise it is held for the specified number of seconds. | ||
| * DeleteAfter - If this is set to ' | * DeleteAfter - If this is set to ' | ||
| + | * ReturnPath - (added in v8.6) - A new value for the ReturnPath (MAILFROM) of the message being sent | ||
| + | |||
| + | ====Examples==== | ||
| + | Example from a customer to change the ReturnPath depending on the ' | ||
| + | |||
| + | <code lua> | ||
| + | -- change ReturnPath with address-only according to address in From-Field | ||
| + | -- Copyright 2024 AT Software und Rechnertechnik GmbH Muenchen | ||
| + | -- last change 09.03.2024 AT/ath | ||
| + | function NewMessage(AuthenticatedSender, | ||
| + | actions = {} | ||
| + | SenderAddressTo = " | ||
| + | SenderSubject = " | ||
| + | MessageHeadersChanged = false | ||
| + | for k,v in pairs(Headers) do | ||
| + | if string.upper(v[1]) == " | ||
| + | SenderSubject = v[2] | ||
| + | if not SenderSubject then SenderSubject = " | ||
| + | end | ||
| + | if string.upper(v[1]) == " | ||
| + | SenderAddressTo = v[2] | ||
| + | if not SenderAddressTo then SenderAddressTo = " | ||
| + | end | ||
| + | if string.upper(v[1]) == " | ||
| + | -- SenderAddressFrom = " | ||
| + | SenderAddressFrom = v[2] | ||
| + | if string.find(SenderAddressFrom, | ||
| + | JustTheAddress = string.match(SenderAddressFrom, | ||
| + | JustTheAddress = string.sub(JustTheAddress, | ||
| + | -- OldReturnPath = " | ||
| + | OldReturnPath = ReturnPath | ||
| + | -- actions[" | ||
| + | actions[" | ||
| + | MessageHeadersChanged = true | ||
| + | print(" | ||
| + | end | ||
| + | end | ||
| + | end | ||
| + | if not MessageHeadersChanged then | ||
| + | print(" | ||
| + | end | ||
| + | return actions | ||
| + | end | ||
| + | </ | ||