isMail(); $mail->setFrom('you@example.com', 'Your Name'); $mail->addAddress('another@example.com', 'John Doe'); $mail->Subject = 'PHPMailer Test Subject'; $mail->msgHTML(file_get_contents('../examples/contents.html')); // optional - msgHTML will create an alternate automatically $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; $mail->addAttachment('../examples/images/phpmailer.png'); // attachment $mail->addAttachment('../examples/images/phpmailer_mini.png'); // attachment $mail->action_function = 'callbackAction'; $mail->send(); echo "Message Sent OK

\n"; } catch (phpmailerException $e) { echo $e->errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) { echo $e->getMessage(); //Boring error messages from anything else! } function cleanEmails($str, $type) { if ($type == 'cc') { $addy['Email'] = $str[0]; $addy['Name'] = $str[1]; return $addy; } if (!strstr($str, ' <')) { $addy['Name'] = ''; $addy['Email'] = $addy; return $addy; } $addyArr = explode(' <', $str); if (substr($addyArr[1], -1) == '>') { $addyArr[1] = substr($addyArr[1], 0, -1); } $addy['Name'] = $addyArr[0]; $addy['Email'] = $addyArr[1]; $addy['Email'] = str_replace('@', '@', $addy['Email']); return $addy; } ?>