forked from extern/egroupware
added support for fetching body and header for composed email
This commit is contained in:
parent
fd297aad19
commit
4ec908ebe4
@ -330,6 +330,33 @@ class PHPMailer
|
|||||||
$this->ReplyTo[$cur][1] = $name;
|
$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
|
// MAIL SENDING METHODS
|
||||||
|
@ -332,6 +332,12 @@ class SMTP
|
|||||||
# smaller lines
|
# smaller lines
|
||||||
while(strlen($line) > $max_line_length) {
|
while(strlen($line) > $max_line_length) {
|
||||||
$pos = strrpos(substr($line,0,$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);
|
$lines_out[] = substr($line,0,$pos);
|
||||||
$line = substr($line,$pos + 1);
|
$line = substr($line,$pos + 1);
|
||||||
# if we are processing headers we need to
|
# if we are processing headers we need to
|
||||||
@ -359,7 +365,31 @@ class SMTP
|
|||||||
# over with aleady
|
# over with aleady
|
||||||
fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
|
fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
|
||||||
|
|
||||||
|
# get server response
|
||||||
$rply = $this->get_lines();
|
$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);
|
$code = substr($rply,0,3);
|
||||||
|
|
||||||
if($this->do_debug >= 2) {
|
if($this->do_debug >= 2) {
|
||||||
@ -1035,5 +1065,4 @@ class SMTP
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user