本文整理汇总了PHP中SMTP::auth_hello方法的典型用法代码示例。如果您正苦于以下问题:PHP SMTP::auth_hello方法的具体用法?PHP SMTP::auth_hello怎么用?PHP SMTP::auth_hello使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMTP
的用法示例。
在下文中一共展示了SMTP::auth_hello方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _send_mail
private function _send_mail($msgdata)
{
$smtp = new SMTP();
$smtp->debug = $this->debug;
if (!$smtp->connect($this->host, $this->port, $this->timeout)) {
$this->error_msg = "SMTP Error: could not connect to SMTP host server";
$this->error_msg .= "[" . $this->host . ":" . $this->port . "]";
return false;
}
if ($this->auth_login) {
if (!$smtp->auth_hello($this->helo, $this->auth_user, $this->auth_pass)) {
$this->error_msg = "SMTP Error: Invalid username/password";
if ($smtp->error_msg) {
$this->error_msg .= "<br>" . $smtp->error_msg;
}
return false;
}
} else {
$smtp->hello($this->helo);
}
if (!$smtp->mail_from(sprintf("<%s>", $this->from))) {
$this->error_msg = "SMTP Error: Mail from [" . $this->from . "] not accepted.";
if ($smtp->error_msg) {
$this->error_msg .= "<br>" . $smtp->error_msg;
}
return false;
}
$iToCount = count($this->to);
for ($i = 0; $i < $iToCount; $i++) {
if (!$smtp->recipient(sprintf("<%s>", $this->to[$i][0]))) {
$this->error_msg = "SMTP Error: recipient [" . $this->to[$i][0] . "] not accepted.";
if ($smtp->error_msg) {
$this->error_msg .= "<br>" . $smtp->error_msg;
}
return false;
}
}
$iCcCount = count($this->cc);
for ($i = 0; $i < $iCcCount; $i++) {
if (!$smtp->recipient(sprintf("<%s>", $this->cc[$i][0]))) {
$this->error_msg = "SMTP Error: recipient [" . $this->cc[$i][0] . "] not accepted.";
if ($smtp->error_msg) {
$this->error_msg .= "<br>" . $smtp->error_msg;
}
return false;
}
}
$iBccCount = count($this->bcc);
for ($i = 0; $i < $iBccCount; $i++) {
if (!$smtp->recipient(sprintf("<%s>", $this->bcc[$i][0]))) {
$this->error_msg = "SMTP Error: recipient [" . $this->bcc[$i][0] . "] not accepted.";
if ($smtp->error_msg) {
$this->error_msg .= "<br>" . $smtp->error_msg;
}
return false;
}
}
if (!$smtp->data($msgdata)) {
$this->error_msg = "SMTP Error: data not accepted";
if ($smtp->error_msg) {
$this->error_msg .= "<br>" . $smtp->error_msg;
}
return false;
}
$smtp->_quit();
}