# Add a Signature to Every WordPress Email

> Appends a short signature, such as your company name, address and support link, to the bottom of every email the site sends, in both plain-text and HTML emails.

- Type: PHP
- Runs: Run everywhere
- Category: [Email](https://wpide.com/library/category/email/)
- Tags: email, signature, branding
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/email-signature-footer/

## Code

```php
$wpide_signature = array(
    'Example Ltd · 1 Main Street, Springfield',
    'Need help? support@example.com',
);

add_filter( 'wp_mail', function ( $atts ) use ( $wpide_signature ) {
    $message = (string) $atts['message'];
    $headers = is_array( $atts['headers'] ) ? implode( "\n", $atts['headers'] ) : (string) $atts['headers'];
    $is_html = false !== stripos( $headers, 'text/html' ) || 'text/html' === apply_filters( 'wp_mail_content_type', 'text/plain' );

    if ( $is_html ) {
        $block = '<p style="margin-top:24px;padding-top:12px;border-top:1px solid #ddd;color:#666;font-size:12px;">' . implode( '<br>', array_map( 'esc_html', $wpide_signature ) ) . '</p>';
        $atts['message'] = false !== stripos( $message, '</body>' ) ? preg_replace( '#</body>#i', $block . '</body>', $message, 1 ) : $message . $block;
    } else {
        $atts['message'] = rtrim( $message ) . "\n\n-- \n" . implode( "\n", $wpide_signature ) . "\n";
    }

    return $atts;
}, 30 );
```

## Notes

Edit the lines at the top; HTML emails get the signature before the closing body tag.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Add a Signature to Every WordPress Email" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
