LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   apache don't know sent out email (https://www.linuxquestions.org/questions/linux-newbie-8/apache-dont-know-sent-out-email-685085/)

chifun 11-21-2008 12:53 AM

apache don't know sent out email
 
Hi,

I am using FC3 with sendmail. I am using DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl. I can sent out email by smtp and receive email.

But in my server. All the CGI and PHP programs cannot sent out email.
All the programs running fine. Just don't know why cannot sent out email.

The sendmail path also is correct : /usr/sbin/sendmail

And in the accress: localhost , 127.0.0.1 is relay

Please kindly help how to fix this problem. Thx a lot.

nidhinmd 11-21-2008 01:39 AM

Use this code

<?php
$to = "recipient@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>

RMLinux 11-21-2008 02:25 AM

Quote:

Originally Posted by chifun (Post 3349554)
Hi,

I am using FC3 with sendmail. I am using DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl. I can sent out email by smtp and receive email.

But in my server. All the CGI and PHP programs cannot sent out email.
All the programs running fine. Just don't know why cannot sent out email.

The sendmail path also is correct : /usr/sbin/sendmail

And in the accress: localhost , 127.0.0.1 is relay

Please kindly help how to fix this problem. Thx a lot.

THIS SETTING I APPLIED IN RHEL4 ON MY OWN SERVER.

PART 1:
1. vi etc/hosts (add the remote server ip address and its domain name in etc/hosts.

192.168.2.3 smtp.example.com

PART 2:

1. vi /etc/mail/sendmail.mc
2. find "dnl #define('SMART_HOST','smtp.example.net')"
3. replace this by your smtp server address. (ex.yahoomail.smtp.net)
4. run make -C /etc/mail
5. service sendmail restart

1. if you want to start on boot. type "chkconfig sendmail on"

chifun 11-22-2008 02:43 AM

thx a lot will try


All times are GMT -5. The time now is 06:25 AM.