Php emails?

Source: Internet
Author: User
Php sends an email question ?????? & Lt ;? Php & nbsp; $ pathCommon = dirname (_ FILE __). & quot; \ _ common5 & quot; & nbsp; $ pathCommon = str_replace (& quot; \ cpar1 & quot;, & quot ;, $ pat php sends an email question ??????
$ PathCommon = dirname (_ FILE _). "\ _ common5 ";
$ PathCommon = str_replace ("\ cpar1", "", $ pathCommon );
Include ($ pathCommon. '\ root. php ');

Class test {
Var $ dbCon;
Var $ root;
Var $ pathCommon;

Var $ js;
Var $ func;
Var $ funcUsage;
Var $ css;
Var $ mail;


Function test ($ pathCommon = ""){
$ This-> pathCommon = $ pathCommon;
$ This-> root = new root ($ this-> pathCommon );
$ This-> root-> DB ();
$ This-> dbCon = new DB ('biticontra ');
$ This-> dbCon-> errorShow = true;
$ This-> js = $ this-> root-> JavaScript ();
$ This-> func = $ this-> root-> Functional ();
$ This-> funcUsage = $ this-> func-> Usage ();
$ This-> css = $ this-> root-> CSS ();
$ This-> view = $ this-> root-> View ();
$ This-> page = $ this-> view-> page ();
$ This-> box = $ this-> view-> box ();
$ This-> grp = $ this-> view-> group ();
$ This-> mail = $ this-> root-> Mail ();
}
}

$ To = "guo321@btechnology.com ";
$ Cc = "guo321@btechnology.com ";
SendMail ("ACTION", '', rtrim ($ To,", "), rtrim ($ Cc,", "), $ Text );

Function sendMail ($ sendTo, $ stepIndex = "", $ to = "", $ cc = "", $ Text = ""){
$ This-> mail-> phpMailer ();
$ Msg =' Dear ALL
';
$ Msg. = $ Text;
$ Subject = "Test ";
$ This-> mail-> sendMail ($ subject, $ msg, "test", $ to, $ cc, "", "", "AA ");
}
?> [Code = PHP] [/code]

------ Solution --------------------
You should encounter such an error:
Using $ this when not in object context


------ Solution --------------------
A lot of problems.
Function sendMail is a function other than the class. why is there a word like $ this?
The phpMailer () function is also undefined ..
In short, lz can first look at the relevant information of OOP
------ Solution --------------------
Let's make up your other knowledge.
Php object-oriented programming
PHP code
 $pathCommon = dirname(__FILE__)."\_common5"; $pathCommon =str_replace("\cpar1","",$pathCommon); include($pathCommon.'\root.php');class test{  var $dbCon;  var $root;  var $pathCommon;    var $js;  var $func;  var $funcUsage;  var $css;  var $mail;  function test($pathCommon=""){        $this->pathCommon = $pathCommon;      $this->root = new root($this->pathCommon);      $this->root->DB();      $this->dbCon = new DB('BITINTRA');      $this->dbCon->errorShow = true;      $this->js = $this->root->JavaScript();        $this->func = $this->root->Functional();      $this->funcUsage = $this->func->Usage();      $this->css = $this->root->CSS();      $this->view = $this->root->View();      $this->page = $this->view->page();      $this->box = $this->view->box();      $this->grp = $this->view->group();      $this->mail = $this->root->Mail();  }    function sendMail($sendTo,$stepIndex="",$to="",$cc="",$Text=""){      $this->mail->phpMailer();      $msg = 'Dear ALL
'; $msg.=$Text; $subject = " Test"; $this->mail->sendMail($subject, $msg, "test", $to, $cc, "", "", "AA"); }} $test = new test(); $To = "guo321@btechnology.com"; $Cc = "guo321@btechnology.com"; $test->sendMail("ACTION",'',rtrim($To,","),rtrim($Cc,","),$Text);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.