Location: PHPKode > scripts > mMail PHP Class > mmail-php-class/mail_html.php
<?php
 require ("mMail.inc");

 $mmail = new mMail ();

 //Set or unset verbose debugging messages, and in particular the outbound
 //data during send!
 $mmail->conf_debug (false);

 /*
 mMail supports the use of ssl:// and tls:// encrypted SMTP connections.  As
 shown in the example below.  If you want to use normal, unencrypted
 connections just use something like:

 $mmail->smtp_host = "smtp.mydomain.com"
 $mmail->smtp_port = 25;
 */
 $mmail->smtp_host = "ssl://smtp.gmail.com";
 $mmail->smtp_port = 465;
 $mmail->smtp_user = "username";
 $mmail->smtp_pass = "password";

 $mmail->from      = "hide@address.com";
 $mmail->subject   = "Test Message";

 //You can optionally set an arbitrary header date, otherwise mMail
 //defaults to the date at point of object instancing
 //$mmail->date      = $mmail->make_date ("2008-08-19 12:51:00 +0800");

 //Add recipient addresses
 $mmail->add_to ("hide@address.com");
 $mmail->add_to ("hide@address.com");
 $mmail->add_to ("hide@address.com");

 //Attach file without inline zip
 $mmail->attach_file ("application/pdf", "document.pdf", file_get_contents ("document.pdf"));

 //Attach file with inline zip
 $mmail->attach_file ("application/pdf", "document.pdf", file_get_contents ("document.pdf"), true);

 //Test HTML Email
 $mmail->attach_html ("<html><body><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque varius. Morbi dui. Ut consectetuer leo non tellus. Sed orci velit, suscipit eget, rutrum eget, porta in, neque. Morbi massa leo, auctor quis, auctor non, tincidunt id, odio. Nulla sollicitudin velit nec lorem. Suspendisse aliquam luctus augue. Quisque in turpis in sapien mattis placerat. Quisque eu tortor. Cras sollicitudin pellentesque arcu. Cras pulvinar. Sed egestas tortor a purus malesuada mattis. Sed lectus nisi, rutrum ut, tempor quis, congue ac, nibh. Donec malesuada imperdiet metus. Duis placerat lectus eget ante. In scelerisque sodales risus. Donec porta. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus quis nunc non sem scelerisque congue.</p><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque varius. Morbi dui. Ut consectetuer leo non tellus. Sed orci velit, suscipit eget, rutrum eget, porta in, neque. Morbi massa leo, auctor quis, auctor non, tincidunt id, odio. Nulla sollicitudin velit nec lorem. Suspendisse aliquam luctus augue. Quisque in turpis in sapien mattis placerat. Quisque eu tortor. Cras sollicitudin pellentesque arcu. Cras pulvinar. Sed egestas tortor a purus malesuada mattis. Sed lectus nisi, rutrum ut, tempor quis, congue ac, nibh. Donec malesuada imperdiet metus. Duis placerat lectus eget ante. In scelerisque sodales risus. Donec porta. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus quis nunc non sem scelerisque congue.</p></body></html>");

 file_put_contents ("test_message.eml", $mmail->send (true));

 fwrite (STDOUT, "MESSAGE LOG:\n");
 print_r ($mmail->get_msglog ());

 fwrite (STDOUT, "ERRORS:\n");
 print_r ($mmail->get_errlog ());

 $mmail->reset ()
 ?>
Return current item: mMail PHP Class