Hi, i read PHPMailer tutorial that we can put a relative path for attachment. But it just doesn't attach the file to my email. Can someone help me, pls? Thanks in advance... Below is my code : //Check the domain name, i.e if it is a gmail account use PHPGmailer to send the mail $splitString = strstr($sentTo, '@'); $getDomain = substr($splitString, 1, strlen($splitString)); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "203.117.178.47"; $mail->Port = 25; $mail->SMTPAuth = true; $mail->Username = "admin@sig-share.com"; $mail->Password = "glamour"; $mail->From = "admin@meninwhite.com.sg"; $mail->FromName = "Sig-Share's Admin"; $mail->Sender = $mail->From; $mail->AddReplyTo("admin@sig-share.com","Information"); $mail->AddAddress($user); // set word wrap $mail->WordWrap = 50; //----Attachment Part ------ $mail->AddAttachment("http://innoform.no-ip.com/site/license/" . $licenseName); // send as HTML $mail->IsHTML(true); $mail->Subject = "License for Sig-Share's iViewer"; $mail->Body = $msg; if(!$mail->Send()) { $_SESSION["dlViewerMsg"] = "License was not sent, reason : $mail->ErrorInfo"; header("Location: http://innoform.no-ip.com/site/download_viewer.php"); } else { header("Location: http://innoform.no-ip.com/site/dlViewer.php"); } Code (markup):
That isn't a relative path - that's a url. A relative path would be something like "./license/".$licenseName or... "/var/www/html/yoursite/license/".$licenseName" or... "../../license/".$licenseName
If this becomes too complicated, scrolling around PHP.net/mail or googling around for attachments and making your own functions would be just as good.