back to phpList.org

Setting up custom email headers, is it possible?

Hello,

As the topic suggests is it possible to create custom email headers of the sort X-CustomHeaderName? My SMTP relay server allows us to have enhanced tracking and statistics capabilities through the use of custom headers.

Thanks!

You would need to write a plugin to provide the extra header by implementing the plugin messageHeaders() method.

  /**
   * messageHeaders
   *
   * return headers for the message to be added, as "key => val"
   *
   * @param object $mail
   * @return array (headeritem => headervalue)
   */
  function messageHeaders($mail) {
    return array();
  }

There is a somewhat lengthy guide to plugin development at https://resources.phplist.com/develop/plugins but you are mainly interested in the section on hooks, https://resources.phplist.com/develop/plugins#application_hooks

1 Like

Hello,
Somebody can help for create a plugin for add custom header based on attribute ?
I don’t really understand how to use that part.
I’m learning php and I need to change the retrun-path address and from adress for make them uniq.
Thx per advance.

@azertyker I’m not sure whether the from and return path headers can be changed in this way. You should review the phplist source code to understand how this method is used. Then maybe have the method return some constant values just to see whether it gives the right result.

But the method does not have direct access to the user attribute values, so you would need to find some way of making them available.