Page 1 of 1

does mail() work with 'local' apache?

Posted: Tue Aug 26, 2003 1:23 am
by wowiz
Hello there....

I have installed the apache 1.3 to run 'locally' in my home win98 system...(Not as a service)...

1. With apache configured like this, can i use mail() function to send an e-mail?How?

2. If yes...what should be the SMTP: ... value in php.ini? The same as in my outlook express6's-->tools-->accounts-->Mail properties-->servers-->Outgoing mail (SMTP): thisvalue?

3. can the value sendmail_from: ...... really be anything with an @ in middle?

Thanks....

Posted: Tue Aug 26, 2003 1:40 am
by volka
  1. yes, php/win32 has its own smtp implementation "on board"
  2. yes, but keep in mind that the standard implementation cannot handle smtp-authentication.
  3. depends on your isp/mail-gateway. My isp at home e.g. requires the from: field to be either my customeriD or one alias I chose when setting up the account

Posted: Tue Aug 26, 2003 2:47 am
by wowiz
so why then.....with the configuration explained above, when i run:

Code: Select all

<?php
	$address="***@***.***";
	$subject="hello";
	$text="This is a test";
	$header="From: Remider <***@***.***>\r\n";
	$header .="MIME-Version: 1.0\r\n";
	$header .="Content-type: text/html\r\n";
	$success=mail($address,$subject,$text,$header);
	if($success)&#123;
		print("\$success is: $success ... GOOD<br />");
	&#125;else&#123;
		print("\$success is: $success ... NO LUCK<br />");
	&#125;
?>
i get on browser:
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in c:\mydir\sample.php on line 8
$success is: ... NO LUCK
Thanks again....

Posted: Tue Aug 26, 2003 3:40 am
by volka
http://php.net/manual/en/function.mail.php wrote: The Windows implementation of mail() differs in many ways from the Unix implementation [...] Second, the custom headers like From:, Cc:, Bcc: and Date: are not interpreted by the MTA in the first place, but are parsed by PHP. PHP < 4.3 only supported the Cc: header element (and was case-sensitive). PHP >= 4.3 supports all the mentioned header elements and is no longer case-sensitive.
So you have to set the proper value in your php.ini

Code: Select all

; For Win32 only.
sendmail_from = ...

Posted: Tue Aug 26, 2003 8:37 am
by wowiz
ok volka.....i have seen that....but still.....

1. There is nothing wrong with the code above....and my PHP is 4.3.2

2. My doubts are in my php.ini settings....where should i look to find the right settings???????

I have these settings:

SMTP:.... same as in my outlook express6-->tools-->accounts-->Mail properties-->servers-->Outgoing mail (SMTP): thisvalue...

sendmail_from:....quote from my study guide:"a string containing the email address of your default PHP mail sender"....so practically anything in form: some@example.com

But still the browser complains:
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in c:\mydir\sample.php on line 8
$success is: ... NO LUCK
WHY......or custom "From:" header missing in c:\mydir\sample.php on line 8.......IT IS NOT MISSING!!!!!!!

Please help.......

PS. is it necessary to enclose the php.ini settings in double or single quotes?

Posted: Tue Aug 26, 2003 10:41 am
by volka
hm, then I have to admit I'm totally clueless.
Did you try the simple examples at http://php.net/manual/en/function.mail.php ?

Posted: Tue Aug 26, 2003 11:38 am
by wowiz
checked that but those examples are similar to my code......so the problem should be with those ini.php settings......