Hi
I've wrote a small bit of code which basiclly sends out an email with an jpg attached, nothing fancy. The code works fine when not included within a function.
However, as soon as it's included within a function the email still sends.. however no jpg is attached.
The code below is it within a function.
Any ideas why is it not adding the attachment when inside a function?
function resendOrder()
{
require_once('OrderMailer/class.phpmailer.php');// need this to send email
$mail = new PHPMailer();
// HTML body
$body = "Testing";
// And the absolute required configurations for sending HTML with attachement
$mail->From = "mark@******.co.uk";
$mail->AddAddress("mark@******.co.uk", "My-webpage Website");
$mail->Subject = "test for phpmailer-3";
$mail->MsgHTML($body);
$mail->AddAttachment("ploxy.jpg");
if(!$mail->Send()) {
echo "There was an error sending the message";
exit;
}
else{
echo "Message was sent successfully";
}
}