View Full Version : Mail

04-10-2003, 04:44 PM

I created a forgot_pass.php page that allow user to enter his or her email address and the password will mail to his or her email.

the code for mail is
mail($contactemail, $subject, $message, $headers); /* this is line 21 and all variables are set correctly*/

Here is my error message
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\BadBlue\PE\web\php\testing_int.php on line 21

Here is my php.ini setting
[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = mike@mikemike.com

If you need more info, please let me know.

Thank you so much


04-10-2003, 06:25 PM
Do you have a SMTP server? On your localhost?

04-10-2003, 08:43 PM
What's on line 21?? and two lines above it.

04-10-2003, 08:48 PM
Sorry, are you talking to me?

Cos you can have your SMTP set to localhost but if it does not exist then it wont work.

Sorry if you werent talkin to me :confused:

04-10-2003, 08:50 PM
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\BadBlue\PE\web\php\testing_int.php on line 21

Was talking to weronpc :cool:


04-10-2003, 08:57 PM

If you do not have an smtp server, you can (sometimes) use your own server.

Find the SMTP line in php.ini and change it to something like:


or whatever your isp's mail server is.

04-11-2003, 04:09 PM
Thank you for you reply,

Here is my situation, I am at work learning php (cuz my work sux). I will finish my work end of this month and I will go back home and I will have my own internet access (Calbe Internet).

I will set up php, mysql and aparche.

I am not sure how mail server works, but what kind of setting I have to do in order to get the mail() function to work?

Thank you,


PS: Is it posible to create my own mail server? eg, allow user to create a user name and use my ip as mailing address. (user_name@my_ip_address)

04-11-2003, 04:16 PM

here is the code

$get_info = mysql_fetch_assoc($mail_sql);

$myname = "Mike";
$myemail = "chim@dfo.ca";

$contactname = "$get_info[user]";
$contactemail = "$get_info[email]";

$message = "here is your request \n Username = \"$get_info[user]\"\n Password = \"$get_info[pass]\"\n\nHave a nice day!!!";
$subject = "Password";

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactname." <".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Mike Server";

mail($contactemail, $subject, $message, $headers);

04-11-2003, 05:39 PM
For PHP beginners, I would reccomend phpdev from http://www.firepages.com.au

04-17-2003, 03:24 PM

http://www.firepages.com.au/ is a really nice site, thank you.

Can you tell me what do I need to use the mail() function in PHP?

Another question (little bit off the topic), I want to install PHP, Aparche, and Mysql. Why people perfer using Linux OS than Window OS? Most people said it's better using Linux but others said Linux is harder to use (installation). But the best, Linux is free..

One more, how do I create a page that when use click on the smilie faces (like this page :) ), and the image will pop up after submited?

Thank you


04-17-2003, 05:04 PM
Right, 1: I use PHP dev ( from the firepages.com.au site ) so I have no experience manually installing Apache, PHP and Mysql. The phpdev program installs it automatically.

to use the mail function, you need an SMTP server.

3: Clickable smilies, hmm. I dunno what you mean. I have my forum where I have clickable smiles, but do you want to know how to make the code appear in the box when you click them, or how to change : ) to :) when the code is submitted?

If you want to change the code into a smiley, I would do it like this...

$message = str_replace(": )", '<img src="happy.gif" />', $message);

Hope this helps you :thumbsup:

04-17-2003, 05:07 PM
One more thing, what is a SMTP server??

04-17-2003, 05:09 PM
An SMTP server is a server that can be used to send e-mail. Example of a SMTP server address is:


To alter the SMTP server, you will have to look in PHP ini.