public function SMTP::Recipient in SMTP Authentication Support 7
Same name and namespace in other branches
- 5 smtp.module \SMTP::Recipient()
- 7.2 smtp.transport.inc \SMTP::Recipient()
Sends the command RCPT to the SMTP server with the TO: argument of $to. Returns TRUE if the recipient was accepted FALSE if it was rejected.
Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
SMTP CODE SUCCESS: 250,251 SMTP CODE FAILURE: 550,551,552,553,450,451,452 SMTP CODE ERROR : 500,501,503,421 @access public
Return value
bool
File
- ./
smtp.transport.inc, line 671 - SMTP mail transport class for the smtp module,based on code of the phpmailer library, customized and relicensed to GPLv2
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. original author: Chris Ryan
Code
public function Recipient($to) {
$this->error = NULL;
// so no confusion is caused
if (!$this
->connected()) {
$this->error = array(
"error" => "Called Recipient() without being connected",
);
return FALSE;
}
fputs($this->smtp_conn, "RCPT TO:<" . $to . ">" . $this->CRLF);
$rply = $this
->get_lines();
$code = substr($rply, 0, 3);
if ($this->do_debug >= 2) {
drupal_set_message(t("SMTP -> FROM SERVER: @rply", array(
"@rply" => $rply,
)));
}
if ($code != 250 && $code != 251) {
$this->error = array(
"error" => "RCPT not accepted from server",
"smtp_code" => $code,
"smtp_msg" => substr($rply, 4),
);
if ($this->do_debug >= 1) {
drupal_set_message(t("SMTP -> ERROR: @error: @rply", array(
"@error" => $this->error["error"],
"@rply" => $rply,
)));
}
return FALSE;
}
return TRUE;
}