Answer the question
In order to leave comments, you need to log in
How to correctly write the path to the file in wp_mail?
Standard Shipping
// удалим фильтры, которые могут изменять заголовок $headers
// remove_all_filters( 'wp_mail_from' );
// remove_all_filters( 'wp_mail_from_name' );
$attachments = array(WP_CONTENT_DIR . '/uploads/attach.zip');
$headers = 'From: My Name <[email protected]>' . "\r\n";
wp_mail('[email protected]', 'Тема', 'Содержание', $headers, $attachments);
// [email protected] - кому отправляем.
$download_form = get_field("download_form", 489);
if($download_form) {
$download_form_sub = substr($download_form['url'], 27);
$attachments = array(WP_CONTENT_DIR . $download_form_sub);
wp_mail($email, 'ggg', $name, 'tyy', $attachments);
}
Answer the question
In order to leave comments, you need to log in
WP_CONTENT_DIR returns the path in the file system. I doubt you need it. Rather, WP_CONTENT_URL is needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question