Page 1 of 1

help needed...mail() function..why m i getting this warning?

Posted: Sat Feb 21, 2004 9:34 am
by crazytopu
Hi,

This is my message.php file

Code: Select all

<?php


<html>
<head>
</head>
<body>
<form action="send.php">
Subject: <input type=text name=subject"><br>
Message: <textarea name=message></textarea><br>
<input type=submit name=submit value=submit>
</form>
</body>
</html>
?>
and this is my send.php file

Code: Select all

<?php
<?
//Program that takes data from the page
//message.php and sends it 
//Connect to database
mysql_connect("localhost","root","");

//Select the database we want to use
mysql_select_db("library");

//Get the contents of the column Email from
//mailinglist table and put in an array.
$sql = "SELECT * FROM mailinglist";
$result = mysql_query($sql);

//data from the message.php page
$subject = $_POST['subject'];
$message = $_POST['message'];

//Send message loop
While ($row = mysql_fetch_array($result)) {
$email = $row['Email'];

//Take notice that we've included $subject and $message below
mail("$email","$subject","$message","From: crazy@raspit.com");

echo("Newsletter sent!<br>");
}


//Close the database connection
mysql_close();
?>
?>
When I run the message.php file and hit submit button it gives me the following error:



Code: Select all

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in c:\program files\apache group\apache\htdocs\send.php on line 24
Newsletter sent!
Does anybody know what to do now? I gave a shot and opened my php.ini file and I got this section which talks about mail() function:

Code: Select all

; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
; etc. Possible values are 0,1,2,4 or combination of them.
; For example, 7 for overload everything.
; 0: No overload
; 1: Overload mail() function
; 2: Overload str*() functions
; 4: Overload ereg*() functions
;mbstring.func_overload = 0
But I got no clue what to do with this section....hope somebody can help me out telling me how to set "sendmail_from" in php.ini file.


By the way my mail server ip is

Code: Select all

202.141.190.5 (mail.raspit.com)
And the account from which I would like to send email is : crazy@raspit.com
hope this information helps

Posted: Sat Feb 21, 2004 10:49 am
by tylerdurden
Your running this on Windows?
In your php.ini there should be a section like this:

Code: Select all

&#1111;mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = me@localhost.com
Enter the correct values and it should work.

Posted: Sat Feb 21, 2004 11:08 am
by crazytopu
yes i m running php in windows...

as you said i did check the section and modified it with new values..

Code: Select all

&#1111;mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = crazy@raspit.com
but yet i m getting the same warning..and no mail is being delivered...any clue?

here is the warning msg:

Code: Select all

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in c:\program files\apache group\apache\htdocs\send.php on line 24
Newsletter sent!
So..do i have to give the account name that i mentioned in my first post ...i mean crazy@raspit.com ? or something else?

thanks for your help

Posted: Sat Feb 21, 2004 11:14 am
by tylerdurden
Hmm. Really can't help you any further, since I never ran php on a Windows machine. But your "localhost" does have an smpt program?

Posted: Sat Feb 21, 2004 11:22 am
by crazytopu
hmmmm you raise a good question...it came into my mind too...but i just dont know how to check if my system is running any SMTP program..

Can you help me out? What kinda SMTP programs you are talking about and where to check them?

thanks........i do appreciate your effort...

Posted: Sat Feb 21, 2004 11:55 am
by tylerdurden
A standard Windows box doesn't have a smpt server app installed. I can't recommend any either. But you could try entering your ISP's smtp server instead, it should be the one you use in your email app.

Posted: Sat Feb 21, 2004 12:12 pm
by crazytopu
thanks...but i got a simple question....do i have to assign that SMTP enty in my php.ini file?

like here?:


Code: Select all

&#1111;mail function] 
; For Win32 only. 
SMTP = ISP's SMTP

Posted: Sat Feb 21, 2004 12:16 pm
by tylerdurden
yes, it should look like

Code: Select all

&#1111;mail function] 
; For Win32 only. 
SMTP = smtp.yourisp.com

Posted: Sun Feb 22, 2004 5:15 am
by crazytopu
Hi, i did change my php.ini file ..it's now look like this

Code: Select all

&#1111;mail function]
; For Win32 only.
SMTP = smtp.raspit.com
after that i restared apache server ...But yet i am receiving this warning msg:

Code: Select all

Warning: mail(): Failed to connect to mailserver at "smtp.raspit.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\program files\apache group\apache\htdocs\send.php on line 24
Newsletter sent!
I did successfully send and receive mail using the SMTP from my MS Outlook....what's wrong?

can anybody help?

i m running php on windows 2k professional..

Posted: Sun Feb 22, 2004 5:33 am
by redhair
tylerdurden wrote:A standard Windows box doesn't have a smpt server
They all come with Outlook Express....
Just a poor joke...sry.

Used the same smtp.adres as you fill in with your regular mail program?

If that don't work your ISP could have blocked port 25 for these kind of activities.

Posted: Sun Feb 22, 2004 8:52 am
by crazytopu
Yes, i m using the same SMTP address that I use with my regula mail.

and i dont understand if my ISP block this port how am i receiving regular mail??!!!!

Posted: Sun Feb 22, 2004 9:24 am
by redhair
I don't know how they did it/ do it, but my isp has done so.

Posted: Sun Feb 22, 2004 9:42 am
by crazytopu
yes i have done it finally! :D

i did use my isp's smtp this time and it worked ..So far i was usign my friend's isp's smtp....do you think i was dumb as i was using another isp's smtp? cant u send/rcv email using another isp's configuration?

thanks to everybody who did help me ...

Posted: Sun Feb 22, 2004 9:47 am
by redhair
crazytopu wrote:....do you think i was dumb as i was using another isp's smtp?
:roll:

Posted: Sun Feb 22, 2004 10:55 am
by Straterra
You can use another ISP's, if they are stupid enough to continue to use SMTP. Most of the larger ISP's are switching over to ASMTP to stop people who do not subscribe from sending emails through their servers. If you would like your own SMTP/POP3 server, I would suggest ArGoSoft. They made a pretty nice little server, with web administration and web checking (like Yahoo! or Hotmail). The free one puts ads on your page, but pay some cash like I did and get the professional version. It's worth it!