Viewing file: 4.php (1.34 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
// Include the phpmailer class
require('ThirdParty/phpmailer/class.phpmailer.php');
// Instantiate it
$mail = new phpmailer();
// Modify this
$yourEmail='your@yourdomain.com';
$yourName='Your Name';
// Modify this
$recipientEmail='your@yourdomain.com';
$recipientName='Your Name';
// Define who the message is from
$mail->From = $yourEmail;
$mail->FromName = $yourName;
// Set the subject of the message
$mail->Subject = 'Test HTML Email';
// Add the HTML body of the message
$html='<b>Hi '.$recipientName.'!</b><br />';
// Embed an image using cid:12345
$html.='This page was generated by <img src="cid:12345">';
// Add message to body
$mail->Body = $html;
// Add the plain text alternative
$txt="Hi ".$recipientName."!\n";
$txt.="This page was generated by PHP";
// Add message as alternative
$mail->AltBody = $txt;
// Add an embedded attachment identify the cid
if ( !$mail->AddEmbeddedImage ('./files/php_logo.gif',
'12345',
'php_logo.gif',
'base64','image/gif') )
echo ( 'Failed to attach file!<br />' );
// Add a recicient address
$mail->AddAddress($recipientEmail, $recipientName);
// Send the message
if(!$mail->Send())
echo ('Mail sending failed');
else
echo ('Mail sent successfully');
?>
|