liquid78 Posted October 23, 2010 Share Posted October 23, 2010 Hi all, I have a problem with mail-attachments: I'm adding a html-file from a subdirectory, let's say "DirectoryX". It works ok: $dir = "directoryX"; $mail->MsgHTML(file_get_contents($dir."/".$html_filename)); After this I take all the image-names in the same folder to an array named $picArray. Now I add attachments to the same mail like this: for ($i=0; $i<count($picArray); $i++) { $mail->AddAttachment($dir."/".$picArray[$i]); } These attachments are added and shown as attachments in the mail BUT the problem is that in the html-file I have references to these images like this: <img src="pic1.jpg"> and these are not shown in the mail. Now if I change the html pic-reference like this: <img src="directoryX/pic1.jpg"> then it works. So for some reason it seems to me that phpmailer adds a folder-name directoryX to the mail and pictures inside it. So it seems that html-file is located in a root folder of that mail and pictures in root/directoryX. Any ideas what causes this? 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.