|
Posted by Jerry Stuckle on 11/16/07 12:30
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
>
> "
> <?php
> // 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 "<h4>Invalid email address</h4>";
> echo "<a href='javascript:history.back(1);'>Back</a>";
> } elseif ($subject == "") {
> echo "<h4>No subject</h4>";
> echo "<a href='javascript:history.back(1);'>Back</a>";
> }
>
> /* 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 "<h4>Thank you for sending suggestion</h4>";
> } else {
> echo "<h4>Can't send email from $email</h4>";
> }
>
> ?>
>
>
> 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
==================
[Back to original message]
|