Thursday, 22 August 2013

sending mail working locally but not in server

sending mail working locally but not in server

I've already searched, and none of the questions here helped me to solve
my problem.
I have to send an email on the website that I'm working on, it works
locally, but when I try sending one on the server, it gives me a fatal
error.
the code:
send_mail.js
$(function() {
$('.enviar').click(function(){
event.preventDefault();
$.ajax({
url: 'modules/send_mail.php',
type: 'POST',
data : {
nome : $('#nome').val(),
mail : $('#mail').val(),
assunto : $('#assunto').val(),
mensagem : $('#mensagem').val()
},
success: function (data) {
console.log(data);
},
error: function(xhr, textStatus, data) {
console.log(xhr.statusText);
console.log(textStatus);
console.log(data);
}
});
});
});
send_mail.php
<?
include_once ('../config.php');
$mail_to = "ricardo.ac.dc@gmail.com";
$nome = stripslashes(strip_tags($_POST['nome']));
$mail = stripslashes(strip_tags($_POST['mail']));
$assunto = stripslashes(strip_tags($_POST['assunto']));
$mensagem = stripslashes(strip_tags($_POST['mensagem']));
$texto = $nome ."(". $mail . ")\r\n";
$texto .= $mensagem;
mail ($mail_to,$assunto,$texto);
?>
form.php
<div class="form_contactos">
<div class="form_text">
<input name="nome" id="nome" placeholder=" nome" type="text"
class="linha_simples"/>
<input name="mail" id="mail" placeholder=" e-mail" type="email"
class="linha_simples"/>
<input name="assunto" id="assunto" placeholder=" assunto"
type="text" class="linha_simples"/>
</div>
<textarea name="mensagem" id="mensagem" placeholder=" mensagem"
class="caixa_texto"></textarea>
<input type="submit" name="enviar" class="submit_button enviar"
id="enviar" value="" />
</div>
The error that I receive is this one:

Fatal error: Function name must be a string in
/home/s002349/public_html/almadados.net/new_site/modules/send_mail.php on
line 26
send_mail.js:22
Can anyone help me with this problem?
*I've cleared all the blank lines on the send_mail.php and cleared all the
cache on the browser, so I don't understand why it still shows that line*

No comments:

Post a Comment