hi i am working on a newsletter field, so that the client just have to fill the field with his email and click on the button and i will receive his email.
so heres my code
<form id="search" action="bat/bulletinhandler.php" method="post">
<input type="text" name="email">
<a onClick="document.getElementById('search').submit()"></a>
</form>
PHP
<?php
//$owner_email = $_POST["owner_email"];
$headers = 'De :' . $_POST["email"];
$subject = 'Bulletin trimestriel';
$messageBody = "";
//Obligatoire
if($_POST['email']!='nope'){
$messageBody .= 'courriel : ' . $_POST["email"] . "\n";
}
try{
if(!mail("hugo@example.com", $subject, $messageBody, $headers)){
throw new Exception('mail failed');
}else{
header('Location: ../index.html');
exit;
}
}catch(Exception $e){
echo $e->getMessage() ."\n";
}
?>
and heres the error im getting
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\HostingSpaces\lavalleesfcom\lavalleesf.com\ on line 14 mail failed
could someone help me with this issue
thanks a lot
so heres my code
<form id="search" action="bat/bulletinhandler.php" method="post">
<input type="text" name="email">
<a onClick="document.getElementById('search').submit()"></a>
</form>
PHP
<?php
//$owner_email = $_POST["owner_email"];
$headers = 'De :' . $_POST["email"];
$subject = 'Bulletin trimestriel';
$messageBody = "";
//Obligatoire
if($_POST['email']!='nope'){
$messageBody .= 'courriel : ' . $_POST["email"] . "\n";
}
try{
if(!mail("hugo@example.com", $subject, $messageBody, $headers)){
throw new Exception('mail failed');
}else{
header('Location: ../index.html');
exit;
}
}catch(Exception $e){
echo $e->getMessage() ."\n";
}
?>
and heres the error im getting
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\HostingSpaces\lavalleesfcom\lavalleesf.com\ on line 14 mail failed
could someone help me with this issue
thanks a lot