troubleshooting Question

PHPMailer Failing when Attachments Added

Avatar of springthorpeSoftware
springthorpeSoftwareFlag for United States of America asked on
JavaScriptPHPMicrosoft IIS Web Server
18 Comments1 Solution2881 ViewsLast Modified:
Have a PHPMailer routine that has been working fine sending HTML emails to users.  Just added ability to include an attachment and it now fails on send with the following error:

PHPMailer Send function failed: Could not instantiate mail function.

Using echos, I have verified that paths to the file(s) are correct, are complete (all the way back to the server's drive letter) and use the "double backslash" when assigning the path variable.  Echos verify that the file exists where indicated.

Doesn't matter if the file is a .zip (the normal) or a .pdf or .txt (also used).  Same error on both.

When I comment out just the $mail->AddAttachment() command, the email sends fine.

Here is the command (I added the "die" to see if this function was the problem):
if ($mail->AddAttachment($filepath, $name, 'base64', $mimetype) === false)
die("Failed when adding " . $filepath . '<br>');

These are individual emails to a single individual, not a blast going out to hundreds of addresses.

Can anyone point me in the right direction?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros