<html lang="ja-jp" dir="ltr"><head></head><body>### [wpforms_emails_mailer_get_attachments](https://wpforms.com/developers/wpforms_emails_mailer_get_attachments/)

**Published:** September 30, 2025
**Author:** Umair Majeed

**Content:**

## Description

The `wpforms_emails_mailer_get_attachments` filter lets you add or modify file attachments for email notifications. By default, WPForms includes uploaded files, but you can use this filter to attach custom files such as PDFs, terms sheets, or other documents.

This filter is useful when you want every notification email to include a specific file or when adding conditional attachments based on the form ID or submission data. The paths must be valid server file paths, not just URLs.

parametertypedescription`$attachments`stringList of file paths to attach.`$mailer`MailerThe Mailer instance for the current email.## Source

`wpforms/src/Emails/Mailer.php`

## Example

```

// Attach a PDF terms sheet to a specific form (ID 42).
function wpf_dev_attach_terms_pdf( $attachments, $mailer ) {
    $form_id = $mailer-&gt;get( 'form_data' )['id'] ?? 0;

    if ( $form_id === 42 ) {
        $attachments[] = WP_CONTENT_DIR . '/uploads/terms.pdf';
    }

    return $attachments;
}
add_filter( 'wpforms_emails_mailer_get_attachments', 'wpf_dev_attach_terms_pdf', 10, 2 );
```

## Reference Article

- [Programmatically Attaching a File to Email Notifications](https://wpforms.com/developers/programmatically-attaching-a-file-to-email-notifications/)

**Categories:** Filters Hooks

---

</body></html>