ec_message_set_envelope

March 26, 2020 Contributors

Name

ec_message_set_envelope — Sets envelope information for the message

Synopsis

#include "ec_message.h"

| int **ec_message_set_envelope** ( | mess, |   |
|   | flags, |   |
|   | localpart, |   |
|   | llen, |   |
|   | domain, |   |
|   | dlen); |   |

ec_message * <var class="pdparam">mess</var>;
int <var class="pdparam">flags</var>;
const char * <var class="pdparam">localpart</var>;
int <var class="pdparam">llen</var>;
const char * <var class="pdparam">domain</var>;
int <var class="pdparam">dlen</var>;

Description

Sets envelope information for the message.

ec_message_set_envelope(bounce_mess, EC_MSG_ENV_TO|EC_MSG_ENV_COMPLETE, emailaddr, -1, NULL, 0);
Parameters

mess

A pointer to an ec_message struct. For documentation of this data structure see “ec_message”

flags

An int parameter which is passed one or more of:

  • If flags includes EC_MSG_ENV_FROM then the envelope sender will be set.

  • If flags includes EC_MSG_ENV_TO, then the envelope recipient will be set.

  • If EC_MSG_ENV_COMPLETE is contained in flags, then the entire address in the localpart buffer will be copied to the appropriate field in ec_message (envelope to or from), and the domain buffer will be ignored.

Warning

It is not valid to pass EC_MSG_ENV_FROM | EC_MSG_ENV_TO as a parameter to flags.

localpart

The address of the provided localpart buffer. The localpart of the email address will be set, assuming the localpart buffer is not NULL.

llen

llen bytes will be copied from the localpart buffer, which need not be NUL terminated. If llen is -1, then the corresponding buffer is assumed to be NUL terminated and data up until the NUL terminator will be copied.

domain

The address of the provided domain buffer. The domain of the email address will be set, assuming the domain buffer is not NULL.

dlen

dlen bytes will be copied from the buffer, which need not be NUL terminated. If dlen is -1, then the corresponding buffer is assumed to be NUL terminated and data up until the NUL terminator will be copied.

Note

If localpart and domain are both NULL, then the address will be set to the null sender address.

Return Values

Returns 1 on success, 0 in case of error (such as out-of-memory).

Threading

It is legal to call this function in any thread.

See Also

ec_message_get_envelope