Hi everybody !
I've got a problem with the contact_form plugin. I write this simple line in a page :
{contact_form email="contact@nomdedomaine.com"}
When I use it, I've the error message :
"Sorry, the message was not sent. The server may be down!"
I've written a little php script to test the php function "mail" :
if (mail("contact@nomdedomaine.com", "test msg", "ok", "From: Toto \r\n")) {
echo 'Votre message a ete envoyé avec succes.';
return;
}
else {
echo 'Probleme';
}
I put it and ran it in the directory "plugins" and it's OK, this script sends mails.
So, I really don't understand where is the problem with contact_form...
If someone can help me, thanks a lot !
Olivier.
Contact form error [solved]
Contact form error [solved]
Last edited by millerx on Mon Jun 25, 2007 1:59 pm, edited 1 time in total.
Re: Contact form error
I had a similar problem. The issue was that my web hosting company's email system requires authentication.
You might want to look at the file function.contact_form.php in the the plugins directory. Line 91 reads
You can change the variable $extra to include your sending address like you used in your test file.
The "From..." is set in $extra on line 68. I would change it to your authorized email address.
Good luck.
You might want to look at the file function.contact_form.php in the the plugins directory. Line 91 reads
Code: Select all
elseif (@mail($to, $subject, $message, $extra))
The "From..." is set in $extra on line 68. I would change it to your authorized email address.
Code: Select all
$extra = "From: Toto <mymail@free.fr>\r\n";
Re: Contact form error
Hello Mesaverde, and thanks for your answer.
You gave me the idea to change every element of the "mail" command and I've found the answer.
The problem seems to come from the variable $to but I can't explain why.
I 've replaced the line :
elseif (@mail($to, $subject, $message, $extra)) {
by the line
elseif (@mail("mymail@free.fr", $subject, $message, $extra)) {
And it's OK. Very strange, but solved...
Thank you again.
You gave me the idea to change every element of the "mail" command and I've found the answer.
The problem seems to come from the variable $to but I can't explain why.
I 've replaced the line :
elseif (@mail($to, $subject, $message, $extra)) {
by the line
elseif (@mail("mymail@free.fr", $subject, $message, $extra)) {
And it's OK. Very strange, but solved...
Thank you again.

Re: Contact form error [solved]
In my case, the server was complaining about bad headers and it said it contained at invalid code 0D.
I solved the issue by removing the "\n" from the $extra line.
//Mail headers
$extra = "From: $name \r";
I solved the issue by removing the "\n" from the $extra line.
//Mail headers
$extra = "From: $name \r";