Connexion Posted September 27, 2006 Share Posted September 27, 2006 Hello,I have been working on this for a couple days on and off and have tried to find my problem but havent been able to figure it out.I am getting the email with a jpg attachment but cant open it, it gives me an error CANNOT DETERMINE FILE TYPE.Any help would be apreciated.Thanks[code]$image_part = $Tech."_".$FirstName."_".$LastName."_".$CompletionDate."_".$HTTP_POST_FILES['Pic1']['name'];$image_list[0] = $image_part;require("phpmailer/class.phpmailer.php");$mail = new PHPMailer();$mail->From = "myaddress@connexioncomm.com";$mail->FromName = $From;$mail->Subject = $FirstName." ".$LastName;$mail->Host = "mail.jobtrackonline.com";$mail->Mailer = "sendmail"; // HTML body $body = "Hello <font size=\"4\">" . "</font>, <p>"; $body .= "Photos have been uploaded for ".$FirstName." ".$LastName."<p>"; $body .= "Sincerely, <br>"; $body .= "Connexion Communications, LLC"; $mail->Body = $body; $mail->AltBody = $text_body; $mail->AddAddress("myaddress@charter.net", "John Doe"); $mail->AddStringAttachment("http://aerocomm.jobtrackonline.com/jobphotos/".$image_list[0],$image_list[0]"); if(!$mail->Send()) echo "There has been a mail error sending to " . $row["email"] . "<br>"; // Clear all addresses and attachments for next loop $mail->ClearAddresses(); $mail->ClearAttachments();[/code] Quote Link to comment https://forums.phpfreaks.com/topic/22249-using-phpmailer-file-attachment-problem/ Share on other sites More sharing options...
HuggieBear Posted September 27, 2006 Share Posted September 27, 2006 I've never used phpMailer before, but the below line doesn't look right to me.[code] $mail->AddStringAttachment("http://aerocomm.jobtrackonline.com/jobphotos/".$image_list[0],$image_list[0]");[/code]You could try:[code] $mail->AddStringAttachment("http://aerocomm.jobtrackonline.com/jobphotos/{$image_list[0]}", "$image_list[0]");[/code]Also, I know that AddAttachment returns false if it can't find or access the file, if AddStringAttachment does, you could try something like this:[code]<?php$attachtest = $mail->AddStringAttachment("http://aerocomm.jobtrackonline.com/jobphotos/{$image_list[0]}", "$image_list[0]");if ($attachtest == false){ echo "Didn't like this line\n";}?>[/code]Anyway, like I said, these are only suggestions as I've never used the class before.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/22249-using-phpmailer-file-attachment-problem/#findComment-99639 Share on other sites More sharing options...
Connexion Posted September 27, 2006 Author Share Posted September 27, 2006 Well you were pretty close. Thank You for the help HuggieBear.Here is what I ended up with.[code]<?php$attachtest = $mail->AddAttachment("/jobphotos/{$image_list[0]}", "$image_list[0]");if ($attachtest == false){ echo "Didn't like this line\n";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/22249-using-phpmailer-file-attachment-problem/#findComment-99826 Share on other sites More sharing options...
winnie Posted October 18, 2006 Share Posted October 18, 2006 Hello,I have some problem with attachment file by using phpmailer too, but my problem is the size of the file.when attached file size is under 100KB, it's work well but when the attached file size over 100KB it's not work (mail does not send).Can anyone tell me why?Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/22249-using-phpmailer-file-attachment-problem/#findComment-110431 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.