Answer the question
In order to leave comments, you need to log in
Own "feedback" module does not send email to joomla 3.1
I decided to write my own primitive feedback, only sending it to the mail, without confirmations, tickets and other functions.
The code is here: https://dl.dropboxusercontent.com/u/59666091/mod_get_price.zip
my mod_get_price.php:
<?php defined('_JEXEC') or die('Direct Access to this location is not allowed.');
require_once('helper.php');
JHTML::stylesheet('styles.css','modules/mod_get_price/css/');
$input = JFactory::getApplication()->input; // only once on each method
$form_send = $input->get('form_send', 'notsend');
switch($form_send){
case 'send':
$your_name = $input->get('your_name', 'No name');
$your_question = $input->get('your_question', 'No question');
$send = ModLittleContactHelper::SendMail($your_name, $your_question);
echo 'Error sending email: ' . $send->message;
if ( $send !== true ) {
echo 'Error sending email: ' . $send->message;
}
require(JModuleHelper::getLayoutPath('mod_get_price', 'sendok_tmpl'));
break;
default:
require(JModuleHelper::getLayoutPath('mod_get_price', 'default_tmpl'));
}
>
<?php defined('_JEXEC') or die('Direct Access to this location is not allowed.');
class ModLittleContactHelper{
public function SendMail($your_name, $your_question){
$config = JFactory::getConfig();
$sender = array($config->get( 'config.mailfrom' ), $config->get( 'config.fromname' ));
$mail->setSender($sender);
$mail->setSubject('Сообщение с сайта');
$mail->addRecipient('[email protected]**.su');
$body = "Вопрос с сайта<br/>";
$body.= "-------------------------<br/>";
$body.= "Пользователь: ".$your_name."<br/>";
$body.= "Вопрос: ".$your_question."<br/>";
$mail->setBody($body);
$mail->IsHTML(true);
$send = $mailer->Send();
return $send;
}
}
>
Answer the question
In order to leave comments, you need to log in
And where actually
Well and $mail, but not $mailer in
as above already paid attention.
Working with mail functions is often not trivial due to differences in the settings of hosters and their fight against spam.
As far as I remember, the most common problem is the sender's address. It must match the account, domain, or something else with the host.
But there are other options as well. Here is a small checklist:
- I don't know the specifics of joomla, but I want to clarify - where do the $mail and $mailer variables in the helper come from?
- Anything written to the error log?
- Is error output enabled? E_ALL?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question