I have a script that forwards an email reply to users with the option of adding an attachment to that mail.
It all works beauthifully with one exception.
I can only add attachments that are physically located on the server.
I am operating within a secure LAN and when I add the attachment from anywhere other than the server it fails to send.
For security reasons I dont want to open access to the server so need to figure this one out, hopefully someone out there has come across this before.
This is an example of what Im using (I have left out the body of the email to save space):
Code: Select all
$mail = new phpmailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Helo = $PROGRAMNAME." phpclient";
$mail->UseMSMailHeaders = on;
$mail->From = $BCIMAIL;
$mail->FromName = $CSMAILNAME;
$mail->Host = $SMTP_SERVER;
$mail->AddAddress($req_emailto, $emailreqname);
$mail->Priority = 1;
$MESSAGEID2 = "Message-ID: <".md5(uniqid(time())).".".$BCIMAIL.">";
$mail->AddCustomHeader($MESSAGEID2);
$mail->AddCustomHeader($XSYSTEM);
$mail->AddReplyTo($BCIMAIL, $CSMAILNAME);
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $subjectline;
if ($resultmethod == "Hardcopy") {
$mail->Body = ("Email text");
}
elseif ($resultmethod == "Electronic") {
$mail->Body = ("Email text");
$mail->AddAttachment("$fn"); // optional name
}Hebbs