Link to home
Start Free TrialLog in
Avatar of chaochenga
chaochenga

asked on

php mail function

I am trying to configure the php mail function and it just does not work.  Here is my setting on php.ini
[mail function]
; For Win32 only.
SMTP = 10.181.5.12 // my email server
smtp_port = 25

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

I can telnet to the mail server with port 25.  So, I know that port is open.  me@mycompany.com is a valid email adress.  However, when I try to email, nothing comes across.  Did I miss anything?

Help

Thanks
Avatar of geodan7
geodan7
Flag of United States of America image

Not sure if this will help...but this is the code I'm using to send feedback from a windows application. This php page is on teh internet and the windows app calls it and sends the feedback message and email address of the person...sends the email to two email addresses.

$emailBody = $_POST['message'];
$fromEmail = $_POST['from'];
if(mail("dan@blah.org,jessica@blah.org","Email alert: Feedback",$emailBody."\r\n\r\nfrom: ".$fromEmail)){
echo 'mail accepted for delivery';
} else {
echo 'mail was not accepted';
}
Avatar of chaochenga
chaochenga

ASKER

here is what I have, which is very similar except it does not work.  

<?php
$to = "me@mycompany.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
 } else {
  echo("<p>Message not sent!</p>");
 }
?>
Do you get a blank email? Or nothing at all?
also...are you using a local email server? or a remote one?
It is a local email server and I am getting nothing at all. The "message not sent" was echoed on the screen very quick, which makes it look like it is not even trying to send.
have you tried using telnet to test your email server/port?

http://support.quadnet.net/Mail.Telnet.htm
yes and that works.
is the message being sent from an internal address TO an internal address?
yes
ASKER CERTIFIED SOLUTION
Avatar of geodan7
geodan7
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
uncomment them obviously...
which file? php.ini or my php script file?
your script file...those lines will hopefully give you some error info to look at...