Хорошо, получается, что вам просто нужно использовать ABSPATH.
$attachments = [
ABSPATH . 'wp-content/themes/themename/resources/img/emails/cropped.png',
ABSPATH . 'wp-content/themes/themename/resources/img/emails/facebook.png'
];
// Send the email and the invoice as an attachment.
wp_mail( 'test@email.com', 'New Invoice', 'Message body sent with attachment.', $headers, $attachments );
Вы также можете настроить их или просто включить в заголовки $:
add_filter( 'wp_mail_content_type', function ( $content_type ) {
return 'text/html';
} );
add_filter( 'wp_mail_from', 'yoursite_wp_mail_from' );
function yoursite_wp_mail_from( $content_type ) {
return 'contact@yoursite.ca';
}
add_filter( 'wp_mail_from_name', 'yoursite_wp_mail_from_name' );
function yoursite_wp_mail_from_name( $name ) {
return 'Your Site Inc.';
}