function send_mail($name, $email, $ip, $is_spam, $message) { $subject = ''; if ($is_spam == false && empty($name) == false && empty($email) == false) { $subject = $GLOBALS['CONTACT_SUBJECT']; $smtp = new SMTP($GLOBALS['SMTP_SERVER'], $GLOBALS['SMTP_PORT']); $smtp->mail_from($email); return $smtp->send($GLOBALS['CONTACT_RECIPIENT'], $subject, "Name: " . $name . "\n\n" . stripslashes($message)); } else { return true; } }
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(); }