php 发送邮件有关问题?
程序员文章站
2022-05-26 07:52:07
...
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 = '
';
$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面向对象编程
$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);相关文章
相关视频
上一篇: ThinkPHP惯例配置文件详解
下一篇: 搭建XSS平台——XSS工具的利用