/ Published in: PHP
http://phpmailer.worxware.com/index.php?pg=methods
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
require_once PATH . '/include/phpmailer/class.phpmailer.php'; $html_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- Facebook sharing information tags --> <meta property="og:title" content="EMAIL_SUBJECT" /> <title>EMAIL_SUBJECT</title> </head> <body>MAIL_TEXT</body> </html>'; $text_body = 'MAIL_TEXT'; $mailer = new PHPMailer(); $mailer->From = 'FROM_EMAIL'; $mailer->FromName = 'FROM_NAME'; $mailer->Subject = 'SUBJECT'; $mailer->ContentType = 'text/html'; $mailer->CharSet = 'utf-8'; $mailer->Priority = 2; $mailer->Body = $html_body; $mailer->AltBody = $text_body; $mailer->IsHTML(true); $mailer->AddAddress(TO_EMAIL); $mailer->AddReplyTo('REPLY_TO_EMAIL'); $mailer->AddAttachment('FILE_PATH', 'FILE_NAME'); if ($mailer->Send()) { echo 'Mail sent'; } else { echo 'Mail error'; }
URL: http://phpmailer.worxware.com/