Wordpress wp_mail with attachment (with meaningful names)
How to use wp_mail function to send attachments with custom names for attachments.
At this point, the email is delivered with an attachment, but the file name is the same as the physical file name.
I cannot rename the files as we have many other links, but I want to submit these files with some meaningful name.
+3
source to share
2 answers
Thanks QArea for your answer. I found this place, need to edit wp-includes / pluggable.php wp_mail function to handle attachment, it should look like this:
if ( !empty( $attachments ) ) {
foreach ( $attachments as $name => $attachment ) {
try {
$phpmailer->AddAttachment($attachment, $name);
} catch ( phpmailerException $e ) {
continue;
}
}
}
+1
source to share