Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sendemail() {
- require_once('[path-to]/class.phpmailer.php');
- $mail = new PHPMailer(true);
- $mail->IsSMTP();
- try {
- $mail->Host = EM_HOST;
- $mail->SMTPDebug = 0; //2 to debug
- $mail->SMTPAuth = EM_AUTH;
- $mail->Username = EM_USER;
- $mail->Password = EM_PASS;
- $mail->AddReplyTo('from@test.com', 'From Name');
- $mail->AddAddress('to@test.com', 'To Name');
- $mail->AddBCC('bcc@test.com', 'BCC Name');
- $mail->SetFrom('from@test.com', 'From Name');
- $mail->Subject = 'Subject String';
- $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
- $body = file_get_contents('[path-to]/emailtemplate.htm');
- $body = eregi_replace("\[fname\]", $_SESSION['fname'], $body);
- $body = eregi_replace("\[sname\]", $_SESSION['sname'], $body);
- $mail->MsgHTML($body);
- $mail->Send();
- @log_this("PDF Sending Success!","email");
- } catch (phpmailerException $e) {
- @log_this("PDF Sending Failed: ".$e->errorMessage(),"email");
- } catch (Exception $e) {
- @log_this("PDF Sending Failed: ".$e->getMessage(),"email");
- }
- }
Add Comment
Please, Sign In to add comment