/** * Central mail-sending function * *@param string $name The name of the sender *@param string $subject The subject of the email *@param string $email The email address *@param string $body The content of the email *@param string $html *@param string $attachment *@param string $attachment_descrip *@return boolean */ function sendMail($name, $subject, $email, $html = TRUE, $body, $attachment = NULL, $attachment_descrip) { //set the email address to nothing s that each user doesn't get 6000 mails! $email = ""; if ($html != TRUE) { $this->objMailer->isHTML = FALSE; } $this->objMailer->AddAddress($email, $name); $this->objMailer->Subject = $subject; $this->objMailer->Body = $body; //check if there is an attachment if ($attachment != '') { //yes there is one, so add it to the message $this->objMailer->AddStringAttachment($attachment, $attachment_descrip); // optional name } //error handler if (!$this->objMailer->Send()) { //tell the user there was a problem return $this->objLanguage->languageText("word_message_failure"); //crash and burn dude exit; } else { //tell the user who mail has been sent to (optional) //echo "Mail sent to $email<br><br>"; //OK mail is sent, so lets clear this recipient and attachment. $this->objMailer->ClearAllRecipients(); $this->objMailer->ClearAttachments(); } //OK mail is sent, so lets clear this recipient and attachment. $this->objMailer->ClearAllRecipients(); $this->objMailer->ClearAttachments(); return TRUE; }
/** * Add one attachmentstring to this object and return the content as a string * * @param object $mail add attachmentstring to this object * @param string $name the name of this file * @param string $html the content/html of the attachment * @param string $ct type of the attachment */ public function addAttachmentString(&$mail, $name, $html, $ct = 'pdf') { $mail->AddStringAttachment($html, $name, 'base64', $ct); return $mail; }