Page 1 of 1

sending email from form

PostPosted: 16. July 2009 19:36
by Dave A
i can connect to db but am stopped in my register form 'cause it says:
An error occurred in script 'C:\xampp\htdocs\reg\5\register.php' on line 78:
mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing
Date/Time: 7-16-2009 14:04:51
i had mercury mail running but i guess that doesn't do it. .not sure what it's for; perhaps some one can let me know that too.
i'm not to computer literate so i hope some one can help. thank you.

Re: sending email from form

PostPosted: 16. July 2009 20:14
by Wiedmann
mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing

Your script is buggy and doesn't set a "From" header. (contact the script author).

While you waiting for a bugfix, you can set the value "sendmail_from" in "php.ini".

Re: sending email from form

PostPosted: 16. July 2009 21:02
by Dave A
thanks i guess it's pretty obvious i didn't write the script. but how do i change the php.ini file and what do i enter? thanks

Re: sending email from form

PostPosted: 16. July 2009 21:10
by Wiedmann
how do i change the php.ini file

- open the file
- change the value
- save the file

and what do i enter?

I can't know which from address you want have. (usually it's your email address)

Re: sending email from form

PostPosted: 16. July 2009 21:18
by Dave A
i changed php.ini. now to contact php guy

Re: sending email from form

PostPosted: 17. July 2009 14:40
by Dave A
what happened to your code for send mail?
here's what i have but get error re $body

Code: Select all
            // Send the email.
            //$body = "Thank you for registering at our User Registration site. To activate your account, please click on this link:\n\n";
            //$body .= "http://www.tottawa.prg/reg/7/activate.php?x=" . mysql_insert_id() . "&y=$a"; //www.tio.ca and it works just leave www.tio/
            //$body .= "activate.php?x=" . mysql_insert_id() . "&y=$a"; //www.tio.com and it works just leave www.tio/
            //mail($_POST['email'], 'Registration Confirmation', $body); //'From: webmaster@temple.ca');
            //added line 80 to end to get xampp to send mail
            
$Text = "This is a test.";
$Html = "<H1>This is a test.</H1>";
$Subject = "PHP Mail Test";
$body .= "activate.php?x=" . mysql_insert_id() . "&y=$a";
$message = '<h3>Thank you for registering! A confirmation email has been sent to your address. Please click on the link in that email in order to activate your account.</h3>';


$headers = "From: deneb118@yahoo.com\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative;
boundary=\"==MIME_BOUNDRY_alt_main_message\"\n\n";
$headers .= "This part of the E-mail should never be seen. If you are
reading this, consider upgrading your e-mail client to a MIME-compatible
client.";

$message .= "--==MIME_BOUNDRY_alt_main_message\n";
$message .= "Content-Type: text/plain; charset=ISO-8859-1\n";
$message .= "Content-Transfer-Encoding: 7bit\n\n";
$message .= $Text . "\n\n";
$message .= "--==MIME_BOUNDRY_alt_main_message\n";
$message .= "Content-Type: text/html; charset=ISO-8859-1\n";
$message .= "Content-Transfer-Encoding: 7bit\n\n";
$message .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0
Transitional//EN\">\n";
$message .= "<HTML><BODY>\n";
$message .= $Html . "\n";
$message .= "</BODY></HTML>\n\n";
$message .= "--==MIME_BOUNDRY_alt_main_message--\n";

mail($To, $Subject, $message, $headers $body);