Jquery's Ajax + Php mail problems


#1

Hi

I’m having a problem with this form and I’m not sure if it is something wrong I’m doing, some problem on the server or what. I’ll try to be be short.

My JS , resumed goes:

[code]
$(’#submit’).click(function(event){
… all checking …
} else {
var dataString = ‘nome=’ + $(“input#nome”).val() + ‘&telefone=’ + $(“input#telefone”).val() + ‘&e-mail=’ + $(“input#e-mail”).val() + ‘&mensagem=’ + $(“textarea#mensagem”).val();
$.ajax({ type: “POST”, url: “mail.php”, data: dataString, success: function() {
alert (‘ok’);
}});

	}[/code]

The php:
[php]
$nome = $_POST[‘nome’];
$telefone = $_POST[‘telefone’];
$email = $_POST[‘e-mail’];
$mensagem = $_POST[‘mensagem’];

$message = "Formulário de Contato ";

$message .= "- Martins Clássicos e Customs


";

$message .= "Nome: $nome

Telefone: $telefone

E-mail: $email

Mensagem -----------------------------

$mensagem

";

$subject= mb_encode_mimeheader($assunto,“UTF-8”, “B”, “\n”);

mail("mail@gmail.com", ‘Contato Site’, $message, "From: $email\nReply-To: ");
[/php]

This was actually up and running for 2 months.

But now it is not workign propperly, most times the email does not get fired, even thou the ajax request is sucessfull.

With simple no-ajax requests I got no problem too.

I took that form to other server and it worked flawless so resuming: I don’t know if either some dreamhost setting changed and I would have to fix it, or if its a problem on the server, or what :frowning:


#2

You are using a false From address — that is, you’re sending mail that claims to be “From:” an address that didn’t actually send it. Use an address for the sender that represents your web site in some way, and include the email address input by the user in the content of the email, or in a Reply-To header.


#3

Thank you

seems that was it


#4

I didn’t realize this was causing an issue with my site until I was alerted by a customer this week.

I have a website form that we’ve been using for a while so customers can open tickets and schedule service calls. It ties in with AutoTask and it uses the from email address to assign it to the account and send them a confirmation email. The form asks them for their email, and the php puts it as the from field.

However (without our knowledge) this has stopped working either late last month or early this month due to Dreamhost. The mail function returns true as it’s succeeding in sending the email; but AutoTask never receives it.

The From address is perfectly valid - but it will not work now unless I put my email address in (with the domain) instead of the customers; this does not work now with AutoTask without manual intervention of opening tickets and re-assigning them to the correct account and sending out manual confirmation emails.

So how can I get this to work the way it was late July???