[wp-trac] [WordPress Trac] #53393: Latest version of PHPMailer no longer attaches files to emails
WordPress Trac
noreply at wordpress.org
Thu Jun 17 20:55:15 UTC 2021
#53393: Latest version of PHPMailer no longer attaches files to emails
--------------------------------+------------------------------
Reporter: threeatetwo | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: External Libraries | Version: 5.7.2
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------------+------------------------------
Comment (by threeatetwo):
Would it be possible in wp_mail to add a filter to handle attachment URLs
and fetch the contents? My temporary fix right now is I copied the wp_mail
function into a plugin and modified it like so:
{{{
if ( ! empty( $attachments ) ) {
foreach ( $attachments as $attachment ) {
try {
if ( substr($attachment, 0, 20 ) === "s3://mybucketnamehere" ) {
$strArray = explode('/',$attachment);
$filename = end($strArray);
$phpmailer->addStringAttachment( file_get_contents($attachment
), $filename);
} else {
$phpmailer->addAttachment( $attachment );
}
} catch ( PHPMailer\PHPMailer\Exception $e ) {
continue;
}
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53393#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list