function functSendEmail($emailaddr, $strSubject, $strBody, $name, $strFromName, $strFromEmail, $strAttachmentFileFullPath, $strEmailType = "text/plain") { //base function to send all emails from webservers smtp service if ($strFromName == "") { $strFromName = EMAIL_FROM_NAME; } if ($strFromEmail == "") { $strFromEmail = EMAIL_FROM_ADDR; } // instantiate the class $mailer = new FreakMailer(); // Get From Variable from Constants File $mailer->ContentType = $strEmailType; if ($strEmailType == "text/html") { $strHTMLMime = true; } else { $strHTMLMime = false; } $mailer->IsHTML($strHTMLMime); $mailer->From = $strFromEmail; $mailer->FromName = $strFromName; $mailer->Subject = $strSubject; $mailer->Body = $strBody; if (is_array($emailaddr)) { foreach ($emailaddr as $email) { $mailer->AddAddress($email, $name); } } else { //send one $mailer->AddAddress($emailaddr, $name); } //now Attach file submitted if ($strAttachmentFileFullPath && file_exists($strAttachmentFileFullPath)) { $mailer->AddAttachment($strAttachmentFileFullPath); } if (!$mailer->Send()) { $strErrorString = 'There was a problem sending this mail!'; } else { $strErrorString = "sent"; } $mailer->ClearAddresses(); $mailer->ClearAttachments(); return $strErrorString; }