Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion content/momentum/3/3-api/structs-ec-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,21 @@ struct _ec_message {
/** @internal */
const char *pathway;
ec_message_resource_t *resources;

/** @since 4.3.2 */
/* set through ec_message_set_routing_domain, then
used in ec_message_get_routing_domain.
This field will not be written to spool */
string _routing_domain;

/** @since 5.2 */
/* TASK-115992: make sure an attempted IP can be logged in case of temp/perm failures */
address attempted_ip;
};
```

To use this struct, include the file `ec_message.h`.

### <a name="idp43608112"></a> See Also

[*Message Functions*](/momentum/3/3-api/ec-message) , and [“ec_message_part”](/momentum/3/3-api/structs-ec-message-part).
[*Message Functions*](/momentum/3/3-api/ec-message) , and [“ec_message_part”](/momentum/3/3-api/structs-ec-message-part).
1 change: 1 addition & 0 deletions content/momentum/4/4-lua-summary-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This section contains tables of Lua functions. Click the function name for detai
| [msg.batch_id](/momentum/4/lua/ref-msg-batch-id) – Returns the human-readable ec_message.batch_id |   | msys.extended.message | 4.0 | data, data_spool, data_spool_each_rcpt, set_binding |
| [msg.conn_id](/momentum/4/lua/ref-msg-conn-id) – Returns the human-readable ec_message.conn_id |   | msys.extended.message | 4.0 | data, data_spool, data_spool_each_rcpt, set_binding |
| [msg.id](/momentum/4/lua/ref-msg-id) – Returns the human-readable ec_message.id |   | msys.extended.message | 4.0 | data, data_spool, data_spool_each_rcpt, set_binding |
| [msg:attempted_ip](/momentum/4/lua/ref-attempted-ip) – Gets the IP address (if any) that was attempted for a failed outbound connection | | msys.extended.message | 5.2 | core_log_delivery_v1, core_log_transient_failure_v1, core_log_permanent_failure_v1 |
| [msg:binding](/momentum/4/lua/ref-msg-binding) – Sets the binding to the named binding, if one is provided | [value] | msys.extended.message | 4.0 | set_binding |
| [msg:binding_group](/momentum/4/lua/ref-msg-binding-group) – Sets the binding_group to the named binding, if one is provided | [value] | msys.extended.message | 4.0 | set_binding |
| [msg:body](/momentum/4/lua/ref-msg-body) – Set or get the message body (minus headers) | [...] | msys.extended.message | 4.0 | data, data_spool, data_spool_each_rcpt, set_binding |
Expand Down
1 change: 1 addition & 0 deletions content/momentum/4/lua/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ description: "This section details all Lua functions Functions are ordered alpha
| [msg.conn_id](/momentum/4/lua/ref-msg-conn-id) | Return the human-readable ec_message.conn_id |
| [msg.id](/momentum/4/lua/ref-msg-id) | Return the human-readable ec_message.id |
| [msg:address_header](/momentum/4/lua/ref-msg-address-header) | Returns address components as an array |
| [msg:attempted_ip](/momentum/4/lua/ref-msg-attempted-ip) | Gets the attempted IP address for a failed outbound connection |
| [msg:binding](/momentum/4/lua/ref-msg-binding) | Set or get the message binding |
| [msg:binding_group](/momentum/4/lua/ref-msg-binding-group) | Sets the binding_group to the named binding, if one is provided. |
| [msg:body](/momentum/4/lua/ref-msg-body) | Set the message body (minus headers) if provided |
Expand Down
37 changes: 37 additions & 0 deletions content/momentum/4/lua/ref-msg-attempted-ip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
lastUpdated: "01/31/2026"
title: "msg:attempted_ip"
description: "msg attempted_ip Gets the IP address (if any) that was attempted for a failed outbound connection"
---

<a name="lua.ref.msg_attempted_ip"></a>
## Name

msg:attempted_ip — Gets the IP address (if any) that was attempted for a failed outbound connection.

> This function was introduced in Momentum 5.2.

<a name="idp69519529"></a>
## Synopsis

`msg:attempted_ip()`

<a name="idp69519530"></a>
## Description

For successful mail deliveries, connection details are available through the connection handle (`conn_handle`) in the message object (`ec_message`). However, when a connection fails, the handle is null. The `attempted_ip` field in the message object can be checked for the IP address that Momentum attempted to connect to. This is useful for logging connection attempts and troubleshooting delivery issues. The `attempted_ip()` function returns `nil` if the IP address is unknown.

<a name="lua.ref.msg_attempted_ip.example"></a>

```
require("msys.core")
require("msys.extended.message")

local mod = {}

function mod:core_log_transient_failure_v1(msg, dr, now, note, note_len)
print(tostring(msg.id) .. ": failed to connect to mail server using the IP address " .. tostring(msg:attempted_ip()))
end

msys.registerModule("example", mod)
```