I use this script to send emails to specific personnel, but due to changes in my system I should now send the attachΓ© via email, and I tried using multi-level code snippets to accomplish this, but were unsuccessful. I still get the letter, but without the attachment, which is completely pointless in this case, I posted the script, I use below
I deleted the real addresses that I used and smtp server
require("PHPMailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "SMTP.SErver.com"; $mail->From = " From@email.com "; $mail->FromName = "HCSC"; $mail->AddAddress(" To@email.com ", "Example"); $mail->AddReplyTo(" Reply@email.com ", "Hcsc"); $mail->WordWrap = 50; $mail->IsHTML(false); $mail->Subject = "AuthSMTP Test"; $mail->Body = "AuthSMTP Test Message!"; $mail->AddAttachment("matt.txt"); //this is basicly what i am trying to attach as a test but will be using excel spreadsheets in the production if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent";
I also tried several other emtods to attach the file, but none of them work. Help is very convenient.
Matthew
source share