back to

Setting up custom email headers, is it possible?


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.


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 but you are mainly interested in the section on hooks,

1 Like

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.