php 發送郵件有關問題?

來源:互聯網
上載者:User
php 發送郵件問題??????
$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();
}
}

$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]

------解決方案--------------------
你應該遇到這樣類似的錯誤:
Using $this when not in object context


------解決方案--------------------
一大堆問題。
function sendMail是類之外的函數,為什麼會有$this這樣的字眼呢?
phpMailer()函數也未定義。。
總之,lz可以先看看 OOP的相關資料
------解決方案--------------------
其它方面的知識自己惡補一下吧。
php物件導向編程
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);
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.