Warning: mail() [function.mail]: "sendmail_from" not set in

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
passingby2010
Forum Newbie
Posts: 3
Joined: Thu Jul 15, 2010 2:42 pm

Warning: mail() [function.mail]: "sendmail_from" not set in

Post by passingby2010 »

Hi all,
I'm trying to set up a php e-mail form ( free script editor from the net ) but unluckily I don't know anything about php.

I hope to be in the right place and in the right topic , otherwise forhive me.

when i try to send the form pressing the submit button I receive this message:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini

I found the same question several times on the web searching with google but I still can't solve the problem ....

Thanks for your time
Bind
Forum Contributor
Posts: 102
Joined: Wed Feb 03, 2010 1:22 am

Re: Warning: mail() [function.mail]: "sendmail_from" not set

Post by Bind »

you need to set the from header

PHP Mail() Function

Code: Select all

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
passingby2010
Forum Newbie
Posts: 3
Joined: Thu Jul 15, 2010 2:42 pm

Re: Warning: mail() [function.mail]: "sendmail_from" not set

Post by passingby2010 »

Hi Bind
thanks x your replay.

I used phpFormGenerator and I got this code at the moment

<?php

$where_form_is="http://".$_SERVER['ftp.olivewood.it'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

// Checkbox handling
$field_6_opts = $_POST['field_6'][0].",". $_POST['field_6'][1];

// Checkbox handling
$field_8_opts = $_POST['field_8'][0];

mail("MY@MAIL.COM","phpFormGenerator - Form submission","Form data:

name: " . $_POST['field_1'] . "
surname: " . $_POST['field_2'] . "
your e-mail: " . $_POST['field_3'] . "
your country: " . $_POST['field_4'] . "
your message: " . $_POST['field_5'] . "
add to mailinglist: $field_6_opts
How did you know about us ?: " . $_POST['field_7'] . "
privacy: $field_8_opts


powered by phpFormGenerator.
");

include("confirm.html");



?>

ps: I tried this code on a server with a earlier version of php and it works fine......

thanks
Bind
Forum Contributor
Posts: 102
Joined: Wed Feb 03, 2010 1:22 am

Re: Warning: mail() [function.mail]: "sendmail_from" not set

Post by Bind »

it's untested but should work.

Code: Select all

<?php
# set headers
$headers = 'From: webmaster@'.$_SERVER['HTTP_HOST']."\r\nReply-To: webmaster@".$_SERVER['HTTP_HOST'];

$where_form_is="http://".$_SERVER['ftp.olivewood.it'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

// Checkbox handling
$field_6_opts = $_POST['field_6'][0].",". $_POST['field_6'][1];

// Checkbox handling
$field_8_opts = $_POST['field_8'][0];

mail("MY@MAIL.COM","phpFormGenerator - Form submission","Form data:

name: " . $_POST['field_1'] . "
surname: " . $_POST['field_2'] . "
your e-mail: " . $_POST['field_3'] . "
your country: " . $_POST['field_4'] . "
your message: " . $_POST['field_5'] . "
add to mailinglist: $field_6_opts
How did you know about us ?: " . $_POST['field_7'] . "
privacy: $field_8_opts


powered by phpFormGenerator.
",$headers);

include("confirm.html");
?>
passingby2010
Forum Newbie
Posts: 3
Joined: Thu Jul 15, 2010 2:42 pm

Re: Warning: mail() [function.mail]: "sendmail_from" not set

Post by passingby2010 »

thanks Bind

it WORKS !!!!

u save my life .....i was getting old with it

really thanks
Post Reply