function SMTP::Send in SMTP Authentication Support 5
Starts a mail transaction from the email address specified in $from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command. This command will send the message to the users terminal if they are logged in.
Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
SMTP CODE SUCCESS: 250 SMTP CODE SUCCESS: 552,451,452 SMTP CODE SUCCESS: 500,501,502,421 @access public
Return value
bool
File
- ./
smtp.module, line 2787 - Enables drupal to send email directly to an SMTP server using authentication. Uses the PHPMailer class by Brent R. Matzelle.
Class
- SMTP
- SMTP is rfc 821 compliant and implements all the rfc 821 SMTP commands except TURN which will always return a not implemented error. SMTP also provides some utility methods for sending mail to an SMTP server. @package PHPMailer @author Chris Ryan
Code
function Send($from) {
$this->error = null;
# so no confusion is caused
if (!$this
->connected()) {
$this->error = array(
"error" => "Called Send() without being connected",
);
return false;
}
fputs($this->smtp_conn, "SEND FROM:" . $from . $this->CRLF);
$rply = $this
->get_lines();
$code = substr($rply, 0, 3);
if ($this->do_debug >= 2) {
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
}
if ($code != 250) {
$this->error = array(
"error" => "SEND not accepted from server",
"smtp_code" => $code,
"smtp_msg" => substr($rply, 4),
);
if ($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
}
return false;
}
return true;
}