note 60446 added to ref.mail

From: Date: Sat, 07 Jan 2006 03:34:49 +0000
Subject: note 60446 added to ref.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-101336@lists.php.net to get a copy of this message
<?php /************************************************************* * Now you can use XPertMailer class to send encoded mime * * type e-mail messages (text, HTML, HTML embeded images, * * attachments) towards a localhost, client, or relay SMTP * * servers with optional authorisation. * * --------------------------------------------------------- * * For more details please visit http://www.xpertmailer.com/ * *************************************************************/ @set_time_limit(0); @error_reporting(E_ALL); require_once 'XPertMailer.php'; /** * send a complex mail - text/html format * with two HTML embeded images and two attachment files * -------------------------------------- */ // you can optionaly use an relay host name $mail = new XPertMailer(SMTP_RELAY, "relay.com"); // set authentification username and password for relay host $mail->auth("username", "password"); // set time out smtp server connection (in secounds) $mail->timeout(30); // set priority high (default is normal) $mail->priority(P_HIGH); // set from mail address and optionaly from name $mail->from("my@account.com", "My Name"); // set each header name and value $header['Cc'] = "example1@domain.com"; $header['Bcc'] = "example2@domain.com"; $header['Reply-To'] = "reply@domain.com"; $header['X-Whatever'] = "description"; // set additional header informations $mail->headers($header); // set HTML embedded images name and optionaly you can rename them // if the file is not in this directory, write the path name // Attention: do not include path name in the rename file // like /path/rename.gif, put only rename.gif $imgs[] = "image1.jpg"; $imgs['rename.gif'] = "image2.gif"; // attach HTML embedded images $mail->attach($imgs, ATTACH_HTML_IMG); // set attachment files name and optional you can rename them // if the file is not in this directory, write the path name $file['new.zip'] = "archive1.zip"; $file[] = "archive2.tar.gz"; // attach files $mail->attach($file, ATTACH_FILE); // set html value // Attention: do not include image path name, // put only <img src="name.jpg"> $html = ' <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"> <html> <body> <img src="image1.jpg" border="0"><br> <b><u><i>next image</i></u></b> :-)<br> <img src="rename.gif" border="2"><br> <font color="red">message html red here</font> </body> </html>'; // send the e-mail and optionaly you can set charset value // as you can see, the text/plain message is required because // not all mail clients can currently support HTML messages $send = $mail->send("expertphp@domain.com", "subject here", "text version", $html, "UTF-8"); // compare the result and print a message echo $send ? "Done." : "Error."; // some useful for debugging echo "<br>Server response: ".$mail->response(); ?> ---- Manual Page -- http://www.php.net/manual/en/ref.mail.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60446 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60446&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60446&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60446&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60446&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60446&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60446&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60446&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60446&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101336) next »