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
[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
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>");
}
?>
<?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?
ASKER
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
http://support.quadnet.net/Mail.Telnet.htm
ASKER
yes and that works.
is the message being sent from an internal address TO an internal address?
ASKER
yes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
uncomment them obviously...
ASKER
which file? php.ini or my php script file?
your script file...those lines will hopefully give you some error info to look at...
$emailBody = $_POST['message'];
$fromEmail = $_POST['from'];
if(mail("dan@blah.org,jess
echo 'mail accepted for delivery';
} else {
echo 'mail was not accepted';
}