send mail error
am 16.11.2007 11:11:43 von upendrajpr
Dear friends
I am sending mail from my site but it gives me some
error
"Warning: mail() [function.mail]: "sendmail_from" not set in php.ini
or custom "From:" header missing in C:\P............."
my code is this
"
// multiple recipients
$to = 'upendrajpr@gmail.com' ; // note the comma
// subject
$subject = 'Suggestion from Website';
// message
$Name = $_POST['Name'];
$message=$_POST['comments'];
$phoneno=$_POST['phoneno'];
$email = $_POST['email'];
//$headers = 'MIME-Version: 1.0' . "\r\n";
//$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// To send HTML mail, the Content-type header must be set
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/" ,
$email)) {
echo "
Invalid email address
";
echo "";
} elseif ($subject == "") {
echo "No subject
";
echo "";
}
/* Sends the mail and outputs the "Thank you" string if the mail is
successfully sent, or the error string otherwise. */
elseif (mail($to, $subject, $message)) {
echo "Thank you for sending suggestion
";
} else {
echo "Can't send email from $email
";
}
?>
plz anybody tell me what could I send my mail.
Thanx in advance.
upendra
Re: send mail error
am 16.11.2007 11:42:53 von BoneIdol
Pretty much you need the sendmail_from set in your php.ini. If you
cannot alter it with your host, try using the code:
ini_set('sendmail_from', 'email@example.com');
My company uses fasthosts to provide our hosting, and they require
that you use this line of code, and the email address must be an email
address on their servers. So it may be worth looking through your
host's help section about this if it does not work correctly.
Re: send mail error
am 16.11.2007 13:30:13 von Jerry Stuckle
upendrajpr@gmail.com wrote:
> Dear friends
>
> I am sending mail from my site but it gives me some
> error
>
> "Warning: mail() [function.mail]: "sendmail_from" not set in php.ini
> or custom "From:" header missing in C:\P............."
>
>
> my code is this
>
> "
>
> // multiple recipients
> $to = 'upendrajpr@gmail.com' ; // note the comma
>
> // subject
> $subject = 'Suggestion from Website';
>
> // message
> $Name = $_POST['Name'];
> $message=$_POST['comments'];
> $phoneno=$_POST['phoneno'];
> $email = $_POST['email'];
>
> //$headers = 'MIME-Version: 1.0' . "\r\n";
> //$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
>
>
> // To send HTML mail, the Content-type header must be set
>
> if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/" ,
> $email)) {
> echo "
Invalid email address
";
> echo "";
> } elseif ($subject == "") {
> echo "No subject
";
> echo "";
> }
>
> /* Sends the mail and outputs the "Thank you" string if the mail is
> successfully sent, or the error string otherwise. */
> elseif (mail($to, $subject, $message)) {
> echo "Thank you for sending suggestion
";
> } else {
> echo "Can't send email from $email
";
> }
>
> ?>
>
>
> plz anybody tell me what could I send my mail.
>
> Thanx in advance.
>
> upendra
>
Like the message says. You either need to set the sendmail_from in your
php.ini file, or you need to add the From: header.
Any mail sent by PHP must identify who it's from. It can either be a
default in your php.ini file or one you specify. But it must be there.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================