Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 02-05-2009, 04:26 PM
2939195631902 2939195631902 is offline
Contributing Member
 
Join Date: 12-14-08
Posts: 140
iTrader: 0 / 0%
Exclamation the mail() function and the arguments i used gives me a critical error. Please help~~

Here is the php code:

$to = $email;
$from = "hank@gmail.com";
$subject = "Email Address Confirmation";
$email_message = "Click the following link to confirm your user account" . "</ br>" . "Do not click the link if you did not expect this email.";
$email_message .= "<a href=\"example.com/visitor_includes/email_confirmation.php?class=" . urlencode("confirm") . "\">" . "</a>";
if (mail($to, $subject, $email_message, $to)) {
redirect_to("visitor_includes/register_successful.php");
} else {
echo "could not send confirmation email";
}





The error message i get is:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\wamp\www\hdflashgames\test.php on line 27
could not send confirmation email
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 02-06-2009, 09:55 AM
Izzmo's Avatar
Izzmo Izzmo is offline
v7n Mentor
 
Join Date: 11-01-03
Location: Kansas
Posts: 1,356
iTrader: 1 / 100%
Well, first of all, it is not </ br> it is <br /> and second of all, that is HTML, and you are not sending out a HTML message, you are sending out a PLAIN TEXT message, therefor, to line break (<br />) you need to replace <br /> with \n.

Also, from the error, it looks like your host may not have sendmail enabled on PHP. Some hosts do this for SPAM protection. Call or e-mail them and ask.

Also, you do not need the extra $to in the mail params. Make it this:

PHP Code:
mail($to$subject$email_message); 
 
Reply With Quote
  #3  
Old 02-06-2009, 01:54 PM
2939195631902 2939195631902 is offline
Contributing Member
 
Join Date: 12-14-08
Posts: 140
iTrader: 0 / 0%
I'm sorry if it was confusing. The <?php and ?> is enabled, i just didn't type it up there.

Thx for pointing out the <br /> mistake.
The second $to is supposed to be $from


As for hosting, i haven't uploaded the website onto my dedicated server yet. I have wamp installed on my computer and thats what i use to develop and test the site. I think you're right about the disabled sendmail in my php.

Do i enable the sendmail in php.ini on my computer? and how?

Since my server is a dedicated server, do i have the power to enable sendmail on my server?
 
Reply With Quote
  #4  
Old 02-06-2009, 02:41 PM
ScriptMan's Avatar
ScriptMan ScriptMan is online now
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 14,019
iTrader: 4 / 100%
Your isp may have the port blocked so you can't really do this:

Quote:
Do i enable the sendmail in php.ini on my computer? and how?
The only real way that I have found to test a send mail script is to upload it to a live server.
 
Reply With Quote
  #5  
Old 02-06-2009, 03:49 PM
Hades's Avatar
Hades Hades is offline
Senior Web Developer
 
Join Date: 01-23-07
Location: Argentina
Posts: 2,273
iTrader: 0 / 0%
Quote:
Originally Posted by ScriptMan View Post
The only real way that I have found to test a send mail script is to upload it to a live server.
Right, the best alternative to the mail() function is to try some library that allows you to connect/authenticate on your SMTP server. that way you can send emails from PHP just as if you were using your favourite client.
 
Reply With Quote
  #6  
Old 02-06-2009, 07:22 PM
2939195631902 2939195631902 is offline
Contributing Member
 
Join Date: 12-14-08
Posts: 140
iTrader: 0 / 0%
What do u mean library.
 
Reply With Quote
  #7  
Old 02-08-2009, 05:56 PM
Izzmo's Avatar
Izzmo Izzmo is offline
v7n Mentor
 
Join Date: 11-01-03
Location: Kansas
Posts: 1,356
iTrader: 1 / 100%
Well, PHP has "libraries" just like any other programming language.

An example of a PHP Library is Simple-XML, or the PEAR functions.
 
Reply With Quote
  #8  
Old 02-08-2009, 05:58 PM
2939195631902 2939195631902 is offline
Contributing Member
 
Join Date: 12-14-08
Posts: 140
iTrader: 0 / 0%
I see. Thx
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML Feed - Fatal error: Call to a member function children() on a non-object jagan Coding Forum 2 08-25-2008 02:22 PM
Critical Self-Consciousness coberst Controversial Social Issues 1 11-13-2007 09:50 AM
Critical SEO Question phkharat SEO Forum 9 01-27-2007 04:28 PM
need help: trouble with mail function.... cuongdm Coding Forum 3 12-25-2005 10:49 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 10:04 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC