Skip to main content

ec_message_render_to_string

Last updated March 2020

Name

ec_message_render_to_string — Renders a message, swapping it in if needed

Synopsis

#include "ec_message.h"

| int **ec_message_render_to_string** ( | mess, |   | |   | str, |   | |   | flags); |   |

ec_message * <var class="pdparam">mess</var>; string * <var class="pdparam">str</var>; int <var class="pdparam">flags</var>;

Description

Renders a message, swapping it in if needed.

ec_message_render_to_string(message, &str, EC_MSG_RENDER_OMIT_DOT|EC_MSG_RENDER_XML)
ec_message_render_to_string(mess, NULL, EC_MSG_RENDER_CALCULATE_LENGTH_ONLY)

Parameters

mess

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

str

The address of the string storing the rendition

flags

Flags that control the message parts that are rendered. See the the section called “Related Constants”

Return Values

Returns the length of the rendered output in bytes.

Related Constants

EC_MSG_RENDER_OMIT_DOT

Omit the trailing SMTP termination dot from the rendition

EC_MSG_RENDER_CALCULATE_LENGTH_ONLY

Calculate the length only

EC_MSG_RENDER_HEADERS_ONLY

Render the rfc2822 headers only

EC_MSG_RENDER_XML

Render the output in an XML based format

EC_MSG_RENDER_OMIT_HEADERS

Don't render the rfc2822 headers

EC_MSG_RENDER_OMIT_EPILOGUE

Don't include epilogue

EC_MSG_RENDER_UNSTUFFED

Remove SMTP dot stuffing while rendering, and use LF instead of CRLF

EC_MSG_RENDER_DEBUG

Enable additional output in debugging mode

EC_MSG_RENDER_AVOID_IO

Don't incur disk IO if we can avoid it

EC_MSG_RENDER_SUPPRESS_WRITE_ERRORS

Don't log write errors, useful when rendering to a static string to limit the amount of the message being requested

Threading

It is legal to call this function in any thread.

Note

This function may induce IO or otherwise block the caller. Blocking in the scheduler thread will lead to degraded performance and should be avoided at all costs. If your code is running in the IO subsystem, the core will have already taken steps to ensure that blocking is acceptable. Otherwise, you should look at using the thread pool API to run a job in the IO pool.

See Also

Was this page helpful?