The command setheader() adds a header line within an email or modifies an existing header line.
Structure of the command
setheader('header','value');
Return value
positive |
always |
Parameters
header
Specifies the header or X-header to be added or changed.
Possible values
•return-path •date •from •sender •reply-to •to •cc •bcc •subject •any other (X-) header
|
If several headers exist with the name indicated under header, the respective first header found will be adapted. |
value
Specifies the value that the header is to assume.
Variables available!
Example 1
Line |
Code |
---|---|
01 |
setheader('x-smenc','yes'); |
Explanation
In this example, the additional header x-smenc is added to an email with the value "yes".
Example 2
Line |
Code |
---|---|
01 |
setheader('from','info@customer.com'); |
Explanation
In this example, the FROM header in an email is changed to the value "info@customer.com".
Example 3
Line |
Code |
---|---|
01 |
if (compare('subject','match','\[priv\]')) { |
02 |
setheader('Disposition-Notification-To','<$from>'); |
03 |
} |
Explanation
In this example, each email with [priv] in the subject of the disposition notification TO header is set to the sender email address of the FROM header in angle brackets as the value (corresponds to the read confirmation request of the email client).