本文整理汇总了PHP中SMTP::AuthHello方法的典型用法代码示例。如果您正苦于以下问题:PHP SMTP::AuthHello方法的具体用法?PHP SMTP::AuthHello怎么用?PHP SMTP::AuthHello使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMTP
的用法示例。
在下文中一共展示了SMTP::AuthHello方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SMTP
function smtp_send($header, $body)
{
global $enable_debug;
$smtp = new SMTP();
$smtp->do_debug = $enable_debug;
$hosts = explode(";", $this->Host);
$index = 0;
$connection = false;
while ($index < count($hosts) && $connection == false) {
if ($smtp->Connect($hosts[$index], $this->Port, $this->Timeout)) {
$connection = true;
}
$index++;
}
if (!$connection) {
$this->error_handler("SMTP Error: could not connect to SMTP host server(s)");
return false;
}
if ($this->blUseAuthLogin) {
if (!$smtp->AuthHello($this->Helo, $this->AuthUser, $this->AuthPass)) {
$this->error_handler("SMTP Error: Invalid username/password");
return false;
}
} else {
$smtp->Hello($this->Helo);
}
$smtp->MailFrom(sprintf("<%s>", $this->From));
for ($i = 0; $i < count($this->to); $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->to[$i][0]))) {
$this->error_handler("SMTP Error: Recipient not accepted. Verify your relay rules");
return false;
}
}
for ($i = 0; $i < count($this->cc); $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->cc[$i][0]))) {
$this->error_handler("SMTP Error: Recipient not accepted. Verify your relay rules");
return false;
}
}
for ($i = 0; $i < count($this->bcc); $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->bcc[$i][0]))) {
$this->error_handler("SMTP Error: Recipient not accepted. Verify your relay rules");
return false;
}
}
if (!$smtp->Data(sprintf("%s%s", $header, $body))) {
$this->error_handler("SMTP Error: Data not accepted");
return false;
}
$smtp->Quit();
}
示例2: SMTP
function _send_mail($msgdata)
{
$smtp = new SMTP();
$smtp->debug = $this->debug;
if (!$smtp->Connect($this->host, $this->port, $this->timeout)) {
$this->errormsg = "SMTP Error: could not connect to SMTP host server";
$this->errormsg .= "[" . $this->host . ":" . $this->port . "]";
return false;
}
if ($this->authlogin) {
if (!$smtp->AuthHello($this->helo, $this->authuser, $this->authpass)) {
$this->errormsg = "SMTP Error: Invalid username/password";
if ($smtp->errormsg) {
$this->errormsg .= "<br/>" . $smtp->errormsg;
}
return false;
}
} else {
$smtp->Hello($this->helo);
}
if (!$smtp->MailFrom(sprintf("<%s>", $this->from))) {
$this->errormsg = "SMTP Error: Mail from [" . $this->from . "] not accepted.";
if ($smtp->errormsg) {
$this->errormsg .= "<br/>" . $smtp->errormsg;
}
return false;
}
$iToCount = count($this->to);
for ($i = 0; $i < $iToCount; $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->to[$i][0]))) {
$this->errormsg = "SMTP Error: Recipient [" . $this->to[$i][0] . "] not accepted.";
if ($smtp->errormsg) {
$this->errormsg .= "<br/>" . $smtp->errormsg;
}
return false;
}
}
$iCcCount = count($this->cc);
for ($i = 0; $i < $iCcCount; $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->cc[$i][0]))) {
$this->errormsg = "SMTP Error: Recipient [" . $this->cc[$i][0] . "] not accepted.";
if ($smtp->errormsg) {
$this->errormsg .= "<br/>" . $smtp->errormsg;
}
return false;
}
}
$iBccCount = count($this->bcc);
for ($i = 0; $i < $iBccCount; $i++) {
if (!$smtp->Recipient(sprintf("<%s>", $this->bcc[$i][0]))) {
$this->errormsg = "SMTP Error: Recipient [" . $this->bcc[$i][0] . "] not accepted.";
if ($smtp->errormsg) {
$this->errormsg .= "<br/>" . $smtp->errormsg;
}
return false;
}
}
if (!$smtp->Data($msgdata)) {
$this->errormsg = "SMTP Error: Data not accepted";
if ($smtp->errormsg) {
$this->errormsg .= "<br/>" . $smtp->errormsg;
}
return false;
}
$smtp->Quit();
}