function mail name JRequest getVar name email JRequest getVar email ph

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function mail(){
$name = JRequest::getVar('name', '');
$email = JRequest::getVar('email', '');
$phone = JRequest::getVar('phone', '');
$text = JRequest::getVar('text', '');
$seller = JRequest::getVar('seller', false);
$body = "<p>Имя: $name</p>";
$body .= "<p>Почта: $email</p>";
$body .= "<p>Телефон: $phone</p>";
$body .= "<p>Сообщение: $text</p>";
$mailer =& JFactory::getMailer();
$config = JFactory::getConfig();
$sender = array(
$config->get( 'config.mailfrom' ),
$config->get( 'config.fromname' ) );
$mailer->setSender($sender);
$mailer->isHTML(true);
$mailer->Encoding = 'base64';
if($seller){
$recipient = $seller;
$title = JRequest::getVar('title', 'none');
$link = JRequest::getVar('link', 'none');
$body = "<p><a href='$link'>$title</a></p>".$body;
}else{
$recipient = $config->get( 'config.mailfrom' );
}
//$recipient = 'alhimikst@yandex.ru';
$mailer->addRecipient($recipient);
$mailer->setSubject('Обратная связь');
$mailer->setBody($body);
$send =& $mailer->Send();
}