Ok, so it's my first time trying to send attachments through PHP and I decided to try it with PHPMailer. I'm trying to attach an excel .xls file to the email, but what it sends is a garbled version of the file. Plus, the HTML body displays perfectly if I don't add an attachment, but once I do, nothing else shows shows up on the email except the (garbled) attachment. Here's the send code: $mail = new phpmailer; $mail->IsMail(); $mail->From = $from_email; $mail->FromName = $from_name; $mail->AddAddress($to_email); $mail->AddReplyTo($reply_email, $reply_name; $mail->AddAttachment("temp.xls", "order.xml", "quoted-printable", "application/vnd.ms-excel"); $mail->IsHTML(true); $mail->Subject = $subject; $mail->Body = $html_body; $mail->Send(); I've tried tinkering with the AddAttachment parameters, the phpmailer class itself, and nothing works. Hopefully, someone can point me in the right direction here. Thanks, in advance, for any help you can offer.
Try isHtml = false; and some more hints $mail->WordWrap = 50;// set word wrap for base encoding example page: http://zainal.wordpress.com/2007/01/10/sending-email-attachments-in-php-using-phpmailer-class/
Read the PHP manual page (at php.net) about mail(). Attaching a file isn't as easy as adding a header. (There are examples of how to do it, but you have to add a boundary at the top and bottom and read the file into the stream.)