ec_message_set_code

March 26, 2020 Contributors

Name

ec_message_set_code — Set the message delivery code meta information

Synopsis

#include "ec_message.h"

| int **ec_message_set_code** ( | message, |   |
|   | code, |   |
|   | codestr); |   |

ec_message * <var class="pdparam">message</var>;
int <var class="pdparam">code</var>;
const char * <var class="pdparam">codestr</var>;

Description

Set the message delivery code meta information.

Note

Before setting the code you must lock the message using ec_message_lock. Once the code is set unlock it using ec_message_unlock.

ec_message_set_code(mess, 0, "554 5.1.2 No Valid Domain")
ec_message_set_code(message, 551, "5.1.3 [internal] rcptto is invalid")

Parameters

message

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

code

An int representing the SMTP delivery status code

codestr

A string with the delivery code meta information

Return Values

This function returns a -1 if the code is an invalid SMTP code (outside the range [1, 999]) or the prior code value, if it existed.

Threading

It is legal to call this function in any thread.

See Also

ec_message_get_code, ec_message_lock, and ec_message_unlock