Ask Your Computer Question. Computer Experts Answer You ASAP.

(Not a Computer Question?)

Php iss and indigomail
Sent to Computer Experts March 19 01:05 AM

I have a server 2003 win runing iss 6.0 and i installed php 5.0 and indigomail(sendmail for windows). I am trying to run a simple mail php script shown below :
<?php

$to = "admin@azphonez.com";
$subject = "This is the subject";
$message = "This is the message";

mail($to, $subject, $message);
?>

I get this error : Warning: mail() [function.mail]: Could not execute mail delivery program 'c:\sendmail\sendmail.exe -test' in C:\Inetpub\ringtone\mail.php on line 7

My php.ini mail functions look like this :

[mail function]
; For Win32 only.
;SMTP = smtp.bizmail.yahoo.com ; for Win32 only
;smtp_port = 25
sendmail_from= me@localhost.com ; for Win32 only

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
include_path=".;c:\sendmail"
sendmail_path = c:\sendmail\sendmail.exe -test



; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

AND My sendmail.ini is perfect
has passwords dont wont cut and paste.

and I know the that the mail function in my script is not even refering to the sendmail.ini

When I comment out the snedmail_path in the php.ini and use the other directives it say i authencation and that info is in the sendmail.ini

1. I need a way to have the php reconize authencation. by the way how is the mail function working with out the path. is is using the smtp on the server.

2. Or I need the path to work.

Send mail user manuel says

The following entries in the php.ini file must be configured<br>

<pre>
[mail function]
;SMTP = localhost     <== COMMENTED OUT
sendmail_from = me@myhost.com     <== SET THIS
sendmail_path = c:\sendmail\semdail.exe -t     <== YOU NEED THIS
</pre>




Optional Information:
OS: Other; Browser: Other

Customer (name blocked for privacy)
Answer
March 19 1:17 AM (11 minutes and 40 seconds later)
         
REPLIEDCheck Mark
In your PHP.ini you have commented out your SMTP server. That could be creating an error in the sendmail program.

Uncomment that and see what happens -- also do you need to use your own SMTP server. Since I assume you are running this on your home PC you should be able to set the php.ini SMTP option to your ISP's mail server and that would accomplish the same task.

Let me know if you need anything else.

Reply
March 19 1:23 AM (6 minutes and 12 seconds later)
         
Reply to Stephen's Post: I read in php.net that if you using sendmail_path then it ignores everything but the sendmail_from. And I have tried that too.

any idea on how to user authenication in the php.ini file not the sendmail.ini
because if I comment out the sendmail_path then it gives me an error saying need authenication.

granted i have to have the SMTP and the smtp_port options on.

or can you tell me whats wrong with the syntax for the sendmail_path =

Ohh if you look carefully you can see that i used the option -test but i tried the -t tooi n the sendmail_path

Edited by Customer (name blocked for privacy) on March 19 2006 at 1:26 AM
Answer
March 19 1:33 AM (9 minutes and 47 seconds later)
         
REPLIEDCheck Mark
The sendmail_path is just a method of forcing PHP to see your sendmail app -- this is useful when your installation was unable to find the sendmail server.

PHP's mail function is not all that advanced, and I think you would have to do the authentication, manually in your application. Not sure about this though, as I have not done it before.

I still think your best option is to point the SMTP = to your ISP mail server. This would solve your problem.
Reply
March 19 1:38 AM (5 minutes later)
         
Reply to Stephen's Post: I have tried that but i get an authencation problem so with out a fix for the authencation I can't accept.

as far as forcing the php to see the sendmail program It is not working either.

Someone please help
Answer
March 19 1:49 AM (11 minutes and 50 seconds later)
         
REPLIEDCheck Mark
OK -- but as of version 4.0 there was no support for authentication. I have not reviewed the change logs for 4.1, but I do know that this is not really top priority for development so I doubt it was added.

Here is a short script that serve your authentication needs.

<?php
$smtp_server = "smtp.yourisp.com";
$port = 25;
$mydomain = "yourisp.com";
$username = "user";
$password = "password";
$sender = "me@acme.com";
$recipient = "joe@company.com";
$subject = "test";
$content = "test";

// Initiate connection with the SMTP server
$handle = fsockopen($smtp_server,$port);
fputs($handle, "EHLO $mydomain\r\n");

// SMTP authorization
fputs($handle, "AUTH LOGIN\r\n");
fputs($handle, base64_encode($username)."\r\n");
fputs($handle, base64_encode($password)."\r\n");

// Send out the e-mail
fputs($handle, "MAIL FROM:<$sender>\r\n");
fputs($handle, "RCPT TO:<$recipient>\r\n");
fputs($handle, "DATA\r\n");
fputs($handle, "To: $recipient\n");
fputs($handle, "Subject: $subject\n\n");
fputs($handle, "$content\r\n");
fputs($handle, ".\r\n");

// Close connection to SMTP server
fputs($handle, "QUIT\r\n");
?>

Bear in mind this is untested, and thrown together, but for a dollar - well you know. ;)

Hope this helps
Reply
March 19 2:45 AM (55 minutes and 9 seconds later)
         
Reply to Stephen's Post: I tried while it is a interesting script. Itdoes not work and there is no error reporting so I dont know what it is and not sure what this is
fputs($handle, "EHLO $mydomain\r\n"); for and I need the mail function to work for my other script
I appreiciate you trying though

Edited by Customer (name blocked for privacy) on March 19 2006 at 2:46 AM
Answer
March 19 2:46 AM (1 minute and 52 seconds later)
         
THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
Answer
March 19 9:39 PM (18 hours and 52 minutes and 29 seconds later)
         
REPLIEDCheck Mark
Did this end up working for you?
Reply
March 19 10:54 PM (1 hour and 14 minutes and 45 seconds later)
         
Reply to Stephen's Post: Is this right
// Initiate connection with the SMTP server
$handle = fsockopen($smtp_server,$port);
fputs ($handle, "HELO $mydomain\r\n");

I run it on my server and i dont get any errors because this simple script has no error reporting in it but
I not sure if fsockopen is right
for smtp you are supposed to use helo though

i aslo changed this
fputs($handle, "MAIL FROM:<$sender>\r\n");
fputs($handle, "RCPT TO:<$recipient>\r\n");
to
fputs($handle, "MAIL FROM: $sender\r\n");
fputs($handle, "RCPT TO: $recipient\r\n");

port = 25;

port = "25";

Edited by Customer (name blocked for privacy) on March 19 2006 at 10:59 PM
Answer
March 19 10:57 PM (2 minutes and 57 seconds later)
         
REPLIEDCheck Mark
Yes - the fsockopen function is correct.

Are you making sure to replace the default connection information with your own personal information ?

What happens when you try and use it?

Reply
March 19 11:04 PM (7 minutes and 12 seconds later)
         
Reply to Stephen's Post: yes
$smtp_server = "smtp.bizmail.yahoo.com";
$port = "25";
$mydomain = "bizmail.yahoo.com";
$username = "admin******";
$password = "******";
$sender = "admin*****.com";
$recipient = "admin*****.com";
$subject = "test";
$content = "test";

I stared out what i did not whant to post

what i mean is
do you think the fsockopen inside a variable would work right
should nt you try
$handle = ($smtp_server,$port);
fsockopen = ($handle);
fputs ($handle, "HELO \r\n");

or somehting lik that
when i use i dont get a email but i dont get any errors that say undefined varible or anything like that




Edited by Customer (name blocked for privacy) on March 19 2006 at 11:08 PM
Answer
March 19 11:08 PM (4 minutes and 12 seconds later)
         
REPLIEDCheck Mark
Do you have access to sendmail through smtp.bizmail.yahoo.com from your ISP ?
Reply
March 19 11:09 PM (1 minute and 8 seconds later)
         
Reply to Stephen's Post: yes
if i use the cmd prompt and goto the sendmail directly I can send a test message to my self
look at my other reply i updated it
Answer
March 19 11:12 PM (2 minutes and 49 seconds later)
         
THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
Answer
March 19 11:21 PM (8 minutes and 48 seconds later)
         
REPLIEDCheck Mark
hmmm -- works perfectly for me.

Are you sure that it not working ?
Reply
March 19 11:26 PM (5 minutes and 27 seconds later)
         
Reply to Stephen's Post: well maybe this is my problem
are you using a windows server or what operating system and how are you running the php.

I also tried adding this

/ Initiate connection with the SMTP server
$handle = fsockopen($smtp_server,$port,$errno,$errstr,30);
if (!$handle) {
     echo "ERROR: $errno - $errstr<br />\n";
} else {
     fputs ($handle, "HELO \r\n");

     // SMTP authorization
     fputs($handle, "AUTH LOGIN\r\n");
     fputs($handle, base64_encode($username)."\r\n");
     fputs($handle, base64_encode($password)."\r\n");

     // Send out the e-mail
     fputs($handle, "MAIL FROM: $sender\r\n");
     fputs($handle, "RCPT TO: $recipient\r\n");
     fputs($handle, "DATA\r\n");
     fputs($handle, "rcpt to: $recipient\r\n");
     fputs($handle, "Subject: $subject\r\n");
     fputs($handle, "$content\r\n");
     fputs($handle, ".\r\n");



     // Close connection to SMTP server
     fputs($handle, "QUIT\r\n");
     }
?>

but if i change my port to 30
i get an error of time out
so there has to be something else wrong

i get no error is the error reporting for the other fputs
i ch
Answer
March 19 11:30 PM (3 minutes and 27 seconds later)
         
REPLIEDCheck Mark
OK - I am running a linux server with sendmail.

I ran the script on one server and pointed it to a remote server also running linux and sendmail.

If you get no errors, then that should mean there are no problems.

The $handle variable stores the socket connection -- so if the connection is not made, then the handle in the fputs will not funciton properly, and will spew out warnings to that effect -- if you display these types off error message in your PHP.


Reply
March 19 11:35 PM (5 minutes and 45 seconds later)
         
Reply to Stephen's Post: ok i am running a WINDOWS server
with php 4 or 5 not sure

when I change the port to 30 i get an error

BUT WHEN I HAVE PORT 25 I DONT GET AN ERROR BUT I DONT GET AN EMAIL EITHER SO THERE HAS TO BE SOMETHING ELSE WRONG , AND THIS IS WHY MY OTHER SCRIPT MIGHT NOT WORK

I CAN ONLY THINK MAYBE MY PHP IS NOT SET UP RIGHT

or Maybe the format for the smtp email is not right so maybe
so let me test this theory through telnet
do you have awindows server you can try this on



Edited by Customer (name blocked for privacy) on March 19 2006 at 11:37 PM
Answer
March 19 11:39 PM (3 minutes and 40 seconds later)
         
REPLIEDCheck Mark
Well - without ALOT more access, I will not be able to determine what sort of problems you are having with your PHP, so .... I am not really sure where to go from here.

Reply
March 19 11:45 PM (5 minutes and 41 seconds later)
         
Reply to Stephen's Post: i can setup a user account an give my ip address and setup the remote administration if you would like to look at but i will have to stop my other webpage so you can access the serve through port 80 I need an email address.
Answer
March 19 11:50 PM (5 minutes and 23 seconds later)
         
REPLIEDCheck Mark
Well, to be completely honest, I am not going to touch your system, without a contract and an NDA. too much risk. Sorry.

I think if you analyze your PHP settings you will be able to find the problem.

create a page and use the phpinfo() option to check your settings and make sure there are no problems there.

I would also contact Yahoo, and make sure that this will work with thier system. They will be able to let you know if thier system is going to allow you to run this type of script against it.

Hope this has been helpful.
Reply
March 20 12:07 AM (16 minutes and 49 seconds later)
         
Reply to Stephen's Post: ok about server access


more info ion suntax and script for phpinfo()
or if you write a script for my with php info or error
I will accept
as far as the yahoo i have been teneting in and got some interesting results
I get a message but no subject no from and no message even though i type it in like the fputs is setup.
Answer
March 20 12:11 AM (3 minutes and 41 seconds later)
         
ACCEPTEDCheck Mark
For a php info page just do this :

<?php
phpinfo();
?>


It will out put a whole list of information that will describe you can look at -- version, configuration and settings, and what your PHP will support and what it won't.



Think you can answer this question?
Login or Become an Expert

 

DISCLAIMER: You acknowledge that any information you may obtain from individuals you contact through use of the Just Answer service comes from those individuals, not from Just Answer!, and that Just Answer is not in any way responsible for any of the information these third parties may supply. The site and services are provided "as is" with no warranty and no representations are made regarding the qualification of an Expert. Responses and comments on Just Answer! are for general information and are not intended to substitute for informed professional advice (such as medical, legal, investment or accounting) and do not establish a professional-client relationship. Just Answer! is not intended or designed to address EMERGENCY QUESTIONS which should be directed immediately by telephone or in-person to qualified professionals. Please carefully read the Terms of Service.

Just Answer! > Computer and Software Help