wp mail – wp_mail Allow Remote Attachments from CDN


I came across a problem with WP_Mail for sending form submissions with file attachments. Our site uses a CDN, so everything uploaded to the site, whether images and media by site builders or documents by users gets put on an external server.

This poses a problem for WP_Mail because it uses the PHPMailer addAttachment method to attach files, which expects local files. I was able to fix this by changing the line in wp_mail to use addStringAttachment, but of course modifying core files isn’t really a fix. What is the right way to do this?


wpdev215 1 year 2022-02-16T10:02:00-05:00 0 Answers 0 views 0

Leave an answer