NelsonJPG Posted December 23, 2016 Share Posted December 23, 2016 I need to send a pdf to a third party through a custom code, but i cant see how to to attach a file to the API, can you tell if there is a way to achieve what i need. I saw the WHMCS uses Phpmailer but i dont know how to require it and use it to send the mail. Thanks in advance. this is how i send email normally... $command = "sendemail"; $adminuser = "admin"; $values["customtype"] = "general"; $values["customsubject"] = "example email attachment"; $values["custommessage"] = "example with file third party"; $values["id"] = $userid; $results = localAPI($command, $values, $adminuser); and this is what i would i like to do... $email = new PHPMailer(); $email->From = 'address1@example.com'; $email->FromName = 'Name'; $email->Subject = 'Message Subject'; $email->Body = $bodytext; $email->AddAddress( 'destinationaddress@example.com' ); $file_to_attach = 'PATH_TO_FILE_HERE'; $email->AddAttachment( $file_to_attach , 'NameOfFile.pdf' ); $email->Send(); Thanks... 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted December 24, 2016 Share Posted December 24, 2016 You'll likely have to call phpmailer() directly, the API isn't designed to do what you're after doing. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.