Title: wp_mail Function &#8211; Undefined Function
Last modified: August 20, 2016

---

# wp_mail Function – Undefined Function

 *  [BobRoberts123](https://wordpress.org/support/users/bobroberts123/)
 * (@bobroberts123)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/wp_mail-function-undefined-function/)
 * I’m trying to get the wp_mail() function to replace the mail() function. I visited:
 * [http://codex.wordpress.org/Function_Reference/wp_mail](http://codex.wordpress.org/Function_Reference/wp_mail)
 * And try their example:
 *     ```
       <?php
          $attachments = array(WP_CONTENT_DIR . '/uploads/file_to_attach.zip');
          $headers = 'From: My Name <myname@mydomain.com>' . "\r\n";
          wp_mail('test@test.com', 'subject', 'message', $headers, $attachments);
       ?>
       ```
   
 * But I’m getting the error: “Call to undefined function wp_mail()”.

The topic ‘wp_mail Function – Undefined Function’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [BobRoberts123](https://wordpress.org/support/users/bobroberts123/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/wp_mail-function-undefined-function/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
