Answer the question
In order to leave comments, you need to log in
The form for sending letters from the site, why sends it is not clear what?
Hello, site on Kohana 3.1 framework.
The form works, letters come to the mail, cuts off the title of the topic, and even does something incomprehensible with the message itself.
Send code
public function action_send()
{
$url = $_SERVER['HTTP_HOST'];
$data = $_POST;
$valid = $data['captcha'];
if(Captcha::valid($valid)){
$namee = $data['namee'];
$email = $data['email'];
$phone = $data['phone'];
$question = $data['question'];
$info = "<table style='font-size:14px' width='100%' border='1' cellpadding='10' cellspacing='0'>
<tbody>
<tr>
<td width='300'><strong>ФИО:</strong></td>
<td>".$namee."</td>
</tr>
<tr>
<td><strong>E-mail: </strong></td>
<td>".$email."</td>
</tr>
<tr>
<td><strong>Контактный телефон: </strong></td>
<td>".$phone."</td>
</tr>
<tr>
<td><strong>Сообщение: </strong></td>
<td>".$question."</td>
</tr>
</tbody>
</table>";
$settings = ORM::factory('setting')->find();
$config = Kohana::$config->load('email');
Email::connect($config);
$subject = "Обратная связь " . $url . "";
$from = '[email protected]сайт.ru';
$message = $info;
$emails = explode(",", $settings->emails);
if(is_array($emails)){
foreach ($emails as $email) {
if (!empty($email)) {
$email = trim($email);
Email::send($email, $from, $subject, $message, true);
}
}
}
echo json_encode(true);
}
else
{
echo json_encode('error_captcha');
}
die;
}
Answer the question
In order to leave comments, you need to log in
The body of the letter is incorrect: the structure of the html document is broken and the encoding in it cools down.
View the source code of the received letter.
Perhaps the problem is in line breaks / encoding.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question