Monday 15 February 2010

php - Fatal Error in PHPMailer -



php - Fatal Error in PHPMailer -

a beginner here.

i have checked forum find out answers not successful, other questions on parts of phpmailer mine more general. hope no 1 mark question duplicate in learning curve.

i working on php project. how works user goes page , writes comments or issues in form (like text editor) , clicks on send button. should able receive message email. have set gmail business relationship here testing purposes later real email own domain.

here error receiving when run on local host:

fatal error: uncaught exception 'phpmailerexception' message 'could not execute: /usr/sbin/sendmail' in c:\xampp\htdocs\pp\classes\class.phpmailer.php:1100 stack trace: #0 c:\xampp\htdocs\pp\classes\class.phpmailer.php(1026): phpmailer->sendmailsend('date: thu, 9 oc...', '--b1_9ea0b33e3f...') #1 c:\xampp\htdocs\pp\classes\class.phpmailer.php(935): phpmailer->postsend() #2

here code using:

<?php require_once("../../classes/class.phpmailer.php"); if($_post['mode']=='send'){ $mail = new phpmailer(true); // true param means throw exceptions on errors, need grab $mail->issendmail(); // telling class utilize sendmail transport //i assume part create run on linux base of operations on google search $body = "new bug study ".$_session['name']."\n".$_post['bug']; $mail->addreplyto('mj@gmail.com', 'mj team'); $mail->addaddress(''.$_session['email'].'', ''.$_session['name'].''); $mail->setfrom(mj@gmail.com', 'mj team'); $mail->addreplyto('mj@gmail.com', 'mj team'); $mail->subject = 'new bug study portal'; $mail->altbody = 'to view message, please utilize html compatible email viewer!'; // optional - msghtml create alternate automatically $mail->msghtml($body); $mail->send(); //and assume part of code makes run on windows based on google search $mail->issmtp(); $mail->smtpauth = true; $mail->host = "smtp.postmarkapp.com"; $mail->port = 26; $mail->username = "mj"; $mail->password = "mj"; $mail->setfrom('mj@gmail.com', 'mj'); $mail->subject = "an email test"; $mail->addaddress($address, $name); if($mail){ $message = 'thanks. bug study sent. in touch if have more questions.'; } else { echo "mailer error: " . $mail->errorinfo; } } ?>

just info not able find user , pass smtp filled with name shouldn't right. since beginner appreciate comments , suggestion code might help me run code.

thank you!

try :

<?php session_start(); if(isset($_post['mode']) && $_post['mode']=='send' && isset($_session['email'], $_session['name'])){ require_once("phpmailerautoload.php"); $mail = new phpmailer(true); //send mail service using gmail $mail->issmtp(); // telling class utilize smtp $mail->smtpauth = true; // enable smtp authentication $mail->smtpsecure = "ssl"; // sets prefix servier $mail->host = "smtp.gmail.com"; // sets gmail smtp server $mail->port = 465; // set smtp port gmail server $mail->username = "mj@gmail.com"; // gmail username $mail->password = "mypassword"; // gmail password //typical mail service info $mail->addaddress($_session['email'], $_session['name']); $mail->setfrom('mj@gmail.com', 'mj'); $mail->subject = "this test message"; $mail->body = "an email test"; try{ $mail->send(); echo "thanks. bug study sent. in touch if have more questions!"; } catch(exception $e){ //something went bad echo "mailer error: - " . $mail->errorinfo; } }else{ echo 'missing required values!'; }

php phpmailer

No comments:

Post a Comment