added support for fetching body and header for composed email

This commit is contained in:
Lars Kneschke 2006-06-23 19:13:22 +00:00
parent fd297aad19
commit 4ec908ebe4
2 changed files with 58 additions and 2 deletions

View File

@ -330,6 +330,33 @@ class PHPMailer
$this->ReplyTo[$cur][1] = $name;
}
function getMessageBody() {
if(!isset($this->sentBody)) {
// Set whether the message is multipart/alternative
if(!empty($this->AltBody))
$this->ContentType = "multipart/alternative";
$this->SetMessageType();
$body = $this->CreateBody();
$this->sentBody = $body;
}
return $this->sentBody;
}
function getMessageHeader() {
if(!isset($this->sentHeader)) {
// Set whether the message is multipart/alternative
if(!empty($this->AltBody))
$this->ContentType = "multipart/alternative";
$this->SetMessageType();
$header = $this->CreateHeader();
$this->sentHeader = $header;
}
return $this->sentHeader;
}
/////////////////////////////////////////////////
// MAIL SENDING METHODS

View File

@ -332,6 +332,12 @@ class SMTP
# smaller lines
while(strlen($line) > $max_line_length) {
$pos = strrpos(substr($line,0,$max_line_length)," ");
# Patch to fix DOS attack
if(!$pos) {
$pos = $max_line_length - 1;
}
$lines_out[] = substr($line,0,$pos);
$line = substr($line,$pos + 1);
# if we are processing headers we need to
@ -359,7 +365,31 @@ class SMTP
# over with aleady
fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
# get server response
$rply = $this->get_lines();
# if the server is slow try to get an answer within 30 seconds
$timeout_counter = 0;
while(($rply=="") && ($timeout_counter<30))
{
$timeout_counter+=1;
sleep(1);
$rply = $this->get_lines();
}
# still no response to our data -> fail!
if($rply=="")
{
$this->error = array("error" => "timeout from server after data sent.",
"smtp_code" => 0,
"smtp_msg" => "(nothing)");
if($this->do_debug >= 1) {
echo "SMTP -> ERROR: " . $this->error["error"] .
": " . $rply . $this->CRLF;
}
return false;
}
$code = substr($rply,0,3);
if($this->do_debug >= 2) {
@ -1035,5 +1065,4 @@ class SMTP
}
?>
?>