2011-02-16 03:43:19 +03:00
|
|
|
<?php
|
|
|
|
/*
|
2013-03-07 01:22:53 +04:00
|
|
|
* Copyright 2005-2013 the original author or authors.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2011-02-16 03:43:19 +03:00
|
|
|
*/
|
|
|
|
|
2012-07-13 16:56:50 +04:00
|
|
|
function webim_mail($toaddr, $reply_to, $subject, $body)
|
2011-02-26 17:04:12 +03:00
|
|
|
{
|
2011-02-16 03:43:19 +03:00
|
|
|
global $webim_encoding, $webim_mailbox, $mail_encoding, $current_locale;
|
|
|
|
|
|
|
|
$headers = "From: $webim_mailbox\r\n"
|
2011-02-26 17:04:12 +03:00
|
|
|
. "Reply-To: " . myiconv($webim_encoding, $mail_encoding, $reply_to) . "\r\n"
|
|
|
|
. "Content-Type: text/plain; charset=$mail_encoding\r\n"
|
|
|
|
. 'X-Mailer: PHP/' . phpversion();
|
2011-02-16 03:43:19 +03:00
|
|
|
|
2011-02-26 17:04:12 +03:00
|
|
|
$real_subject = "=?" . $mail_encoding . "?B?" . base64_encode(myiconv($webim_encoding, $mail_encoding, $subject)) . "?=";
|
2011-02-16 03:43:19 +03:00
|
|
|
|
2011-02-26 17:04:12 +03:00
|
|
|
$body = preg_replace("/\n/", "\r\n", $body);
|
|
|
|
|
|
|
|
@mail($toaddr, $real_subject, wordwrap(myiconv($webim_encoding, $mail_encoding, $body), 70), $headers);
|
2011-02-16 03:43:19 +03:00
|
|
|
}
|
|
|
|
|
2013-03-13 01:03:50 +04:00
|
|
|
?>
|