A
A
Anton2016-05-26 18:01:41
Kohana
Anton, 2016-05-26 18:01:41

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;  
}

Here's what I send:
825dcc0ac8404810a1dd827552f1ff35.jpg
Here's what comes in the mail:
08ea82e18b584825890a8f5652a9fc3a.jpg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Shamanov, 2016-05-26
@SilenceOfWinter

The body of the letter is incorrect: the structure of the html document is broken and the encoding in it cools down.

A
Alexey, 2016-05-26
@alsopub

View the source code of the received letter.
Perhaps the problem is in line breaks / encoding.

#
#algooptimize #bottize, 2016-05-26
@user004

No escape and must be cast to one encoding.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question