***************************************/ define('CRLF', "\r\n", TRUE); /*************************************** ** Create the mail object. Optional headers ** argument. Do not put From: here, this ** will be added when $mail->send ** Does not have to have trailing \r\n ** but if adding multiple headers, must ** be seperated by whatever you're using ** as line ending (usually either \r\n or \n) ***************************************/ $mail = new html_mime_mail('X-Mailer: Html Mime Mail Class'); /*************************************** ** We will just send a text email ***************************************/ $text = $mail->get_file('example.txt'); $mail->set_body($text); /*************************************** ** Builds the message. ***************************************/ $mail->build_message(); /*************************************** ** Send the email using smtp method. ** This is the preferred method of sending. ***************************************/ include 'class.smtp.inc'; $smtp = new smtp_class(); $smtp->host_name = '10.1.1.2'; // Address/host of mailserver $smtp->localhost = 'localhost'; // Address/host of this machine (HELO)
***************************************/ define('CRLF', "\r\n", TRUE); /*************************************** ** Create the mail object. Optional headers ** argument. Do not put From: here, this ** will be added when $mail->send ** Does not have to have trailing \r\n ** but if adding multiple headers, must ** be seperated by whatever you're using ** as line ending (usually either \r\n or \n) ***************************************/ $mail = new html_mime_mail('X-Mailer: Html Mime Mail Class'); /*************************************** ** Read the file test.zip into $attachment. ***************************************/ $attachment = $mail->get_file('example.zip'); /*************************************** ** Since we're sending a plain text email, ** we only need to read in the text file. ***************************************/ $text = $mail->get_file('example.txt'); /*************************************** ** To set the text body of the email, we ** are using the set_body() function. This ** is an alternative to the add_html() function ** which would obviously be inappropriate here. ***************************************/ $mail->set_body($text); /*************************************** ** This is used to add an attachment to ** the email.
define('CRLF', "\r\n", TRUE); /*************************************** ** Create the mail object. Optional headers ** argument. Do not put From: here, this ** will be added when $mail->send ** Does not have to have trailing \r\n ** but if adding multiple headers, must ** be seperated by whatever you're using ** as line ending (usually either \r\n or \n) ***************************************/ $mail = new html_mime_mail('X-Mailer: Html Mime Mail Class'); /*************************************** ** Read the image background.gif into ** $background ***************************************/ $background = $mail->get_file('background.gif'); /*************************************** ** Read the file test.zip into $attachment. ***************************************/ $attachment = $mail->get_file('example.zip'); /*************************************** ** If sending an html email, then these ** two variables specify the text and ** html versions of the mail. Don't ** have to be named as these are. Just ** make sure the names tie in to the ** $mail->add_html() call further down. ***************************************/ $text = $mail->get_file('example.txt'); $html = $mail->get_file('example.html'); /***************************************
***************************************/ define('CRLF', "\r\n", TRUE); /*************************************** ** Create the mail object. Optional headers ** argument. Do not put From: here, this ** will be added when $mail->send ** Does not have to have trailing \r\n ** but if adding multiple headers, must ** be seperated by whatever you're using ** as line ending (usually either \r\n or \n) ***************************************/ $mail_1 = new html_mime_mail('X-Mailer: Html Mime Mail Class'); /*************************************** ** First email. ***************************************/ $text = $mail_1->get_file('example.txt'); $mail_1->set_body($text); /*************************************** ** Add the attachment ***************************************/ $file = $mail_1->get_file('example.zip'); $mail_1->add_attachment($file, 'example.zip', 'application/zip'); /*************************************** ** Builds the message. ***************************************/ $mail_1->build_message(); /*************************************** ** Don't send this email, but use the ** get_rfc822() method to assign it to a ** variable. ***************************************/