WordPress Send Mail With Attachment

Send mail with attachment in wordpress

 <?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?> 

Example usage

<?php

$attachments = array(WP_CONTENT_DIR . '/uploads/file_to_attach.zip');
$headers = 'From: My Name <[email protected]>' . "\r\n";
wp_mail('[email protected]', 'subject', 'message', $headers, $attachments);

Leave a Reply

Your email address will not be published. Required fields are marked *