Determine which channel an address rewrites to.
const char *mtaAddressToChannel(char *channel, size_t *channel_len, size_t channel_len_max, const char *address, size_t address_len, int address_type, int item_code, ...); |
Arguments |
Description |
---|---|
channel |
A pointer to a buffer to receive the NULL terminated channel name. To avoid possible truncation of the channel name, this buffer must be at least CHANLENGTH+1 bytes long. |
channel_len |
An optional pointer to a size_t to receive the length in bytes of the returned channel name. This length does not include the NULL terminator that terminates the channel name. |
channel_len_max |
The maximum size in bytes of the buffer pointed at by the channel argument. |
address |
The address to rewrite. The length of this address, not including any NULL terminator, should not exceed ALFA_SIZE bytes. If a value of 0 is passed for the address_len argument, then this string must be NULL terminated. |
address_len |
The length in bytes of the address string, address. This length does not include any NULL terminator. If a value of 0 is passed for this argument, the address string must be NULL terminated. |
address_type |
Indicates what type of address is being rewritten. There are two types: envelope or header. In addition it can be either forward or reverse pointing. See the description for a list of the possible values. |
item_code |
Reserved for future use. Presently, a value of 0 must be supplied for this argument. |
Use this routine to determine which channel an address rewrites to. The address to be rewritten can be an envelope or header address, and can be forward or reverse pointing. The nature of the address is specified with the address_type argument. The following table lists the possible values for each combination: forward pointing envelope, reversing pointing envelope, forward pointing header, reverse pointing header:
Types of Address |
Value |
---|---|
Forward pointing envelope address |
0, MTA_BCC, MTA_CC, MTA_ENV_TO, MTA_TO |
Reverse pointing envelope address |
MTA_ENV_FROM |
Forward pointing header address |
MTA_HDR_BCC, MTA_HDR_CC, MTA_HDR_TO |
Reverse pointing header address |
MTA_HDR_FROM |
In most cases, a value of MTA_ENV_TO is appropriate. Other values will typically give the same result, unless the MTA configuration has rewrite rules that are sensitive to the distinctions between the four types of addresses.
On successful operation, the routine returns the value of the channel argument. In the event of an error, the value returned is NULL and the mta_errno variable is set with an error status code. The following table lists the error status codes and gives a description of each.
None