OVH Community, your new community space.

php mail() does not work


freshwire
02-03-2009, 18:23
Some mail server work much better with just "\n" instead of "\r\n" see which works best for you

yonin
01-03-2009, 23:45
yep, there must have been something wrong with the headers.
Thank you for help - now it works.
Cheers!

Andy
01-03-2009, 23:32
Keep it simple and just test it with:

PHP Code:
$Name "Da Duder"//senders name
$email "email@adress.com"//senders e-mail adress
$recipient "PersonWhoGetsIt@emailadress.com"//recipient
$mail_body "The text for the mail..."//mail body
$subject "Subject for reviever"//subject
$header "From: "$Name " <" $email ">\r\n"//optional headerfields

ini_set('sendmail_from''me@domain.com'); //Suggested by "Some Guy"

mail($recipient$subject$mail_body$header); //mail command :)
?>

yonin
01-03-2009, 23:28
here's the code:
Code:
		$headers = 'From: webmaster@example.com' . "\r\n" .
			'Reply-To: webmaster@example.com' . "\r\n" .
			'X-Mailer: PHP/' . phpversion();		
		if (!mail($CONTACT_ALL, $CONTACT_SUBJECT, $this->contactHeader().$this->message.$this->toString(), $headers)) {
			$this->errors["email"] .= "Failed to send the message :(";
		}

Andy
01-03-2009, 23:10
Did you specify a FROM address?

You could post the code here for us to debug if thats OK?

yonin
01-03-2009, 22:49
Hi!
I have written simple page, from which I'm sendning an email to my address.
I use the php's mail() function, but it doesn't work - it returns false and the mail isn't sent.
I have 60gp hosting.

Any suggestions?
Thanks,
Yonin.