Sendmail

Let me start with…I am brand new to sendmail.

I have a web application running on APACHE2. I’m told that it uses a PHP mail function to send emails for notifications. I configured my php.ini to use sendmail by adding the following line:

sendmail_path= /usr/sbin/sendmail -t -i (ive tried it without the i as well)

As far as the sendmail configuration is concerned, I used the GUI interface provided in the KDE environment (labeled Mail Transfer Agent).

I inputted my outgoing mail server’s IP address and login information. I also unchecked TLS since my mail server does not use that.

The problem is that no email ever gets sent. The web application states that the email was successfully sent…But I think its because it hands the email to php…(leaving the responsiblity to PHP)…then it believes the email is sent.

My mail server uses plain text for authentication. Im not doing anything special with it. I told my mail server to accept connections from my linux box.

I also checked my mail server’s logs and see that no record of any connection from my linux server is logged. So it seems my linux server isnt even communicating with my mail server.

Both boxes are on the same network. My linux box can ping my mail server just fine. Firewall is disabled.

So my question is, How do I correclty configure sendmail to use an outgoing SMTP server to send emails…And how do I verify that setting works without using the web application I installed? (I want to verify whether or not the issue is with sendmail or the web application)

One more question…Where do I find sendmail’s logs so I can check to see why it’s not hitting my mail server?

This problem has been plaguing me for weeks now :frowning:

You shouldn’t need to edit php.ini, it goes to sendmail by default anyway. And that sendmail is actually a compatibility program provided by postfix. But anyway…

When you use sendmail from PHP, it’s actually going to the local postfix process. So you should look at /var/log/mail on the same box as the Apache server. That postfix server may or may not have permission to send outgoing mail by itself. If not, then you have to specify the relayhost for it in the postfix config, which should be the official mail server.

And of course the mail server should accept mail from your Apache server. You can test this by telnet to it on port 25 and simulating a mail delivery. That’s a useful trick for any Linux/Unix admin to know, how to simulate incoming mail by telnet to port 25.

I don’t know how to do that from GUI. But basically you have to set a smarthost in /etc/postfix/transport. Example:


yourhost.yourdomain      local:
localhost.yourdomain     local:
yourdomain              : 
.yourdomain             :
*                       smtp:[yoursmtp]

Replace yourhost, yourdomain, yoursmtp to match your system.

Then build the database with :
/usr/sbin/postmap /etc/postfix/transport

in /etc/postfix/main.cf, add the line :

transport_maps = hash:/etc/postfix/transport

Finally restart postfix : /etc/rc.d/postfix reload

Hope it helps.

No need to edit transport, it’s just one setting in /etc/sysconfig/postfix, POSTFIX_RELAYHOST.

Does your mailserver have an MX record ?
What did you mean by “configure sendmail to use an outgoing SMTP server to send emails” ?
I thought the mails you where trying to send didn’t reach their destination (as they would be rejected if your mailserver is unknown) and you wanted to use an external SMTP to send emails. In that case, that would be a ‘smarthost’. A relayhost is something else. However I don’t know what the sysconfig variable
POSTFIX_RELAYHOST actually does.

It just sets relayhost in main.cf. However you should do this edit through YaST so that main.cf is reconfigured. Or run SuSEconfig --module postfix afterwards.

please_try_again, I tried to do what you said…But I only see a transport.db file…not a file with the name only transport.

ken_yap, I tried exactly what you said. I added my mail server’s IP to POSTFIX_RELAYHOST…then ran SuSEconfig and restarted apache…and no change.

Back to please_try_again, My mail server does have an MX record. This is a working mail server that has been up for years. I send and receive email all the time to hotmail…gmail…aol…etc…with no failures.

And by “configure sendmail to use an outgoing SMTP server to send emails”, I mean that I do not want sendmail to be the actual email server (mail delivery agent). I want it to pass on the outgoing request to my existing mail server.

Problem is that it seems to not even be connecting to it.

I’m seeing a lot of postfix comments here. Do I need to have postfix installed? I thought it couldn’t work with sendmail (I tried installing postfix…but it said I needed to deinstall sendmail)

Ah, you should have just stuck with the default of postfix that openSUSE gives you. If you had installed sendmail, that was unnecessary. As I said, postfix provides a sendmail compatibility program. Reinstall postfix and do the POSTFIX_RELAYHOST thing again.

Hey Ken_Yap. I did exactly what you said…and same thing occurs.

Is there a way to verify that your setting works without me using the web app i installed? I want to see if the problem is with postfix…or the web application.

Yes, telnet to localhost port 25 and simulate a mail delivery by hand.

The telnet revealed:

Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
220 hostname.o ESMTP Postfix

As far as sending the email by hand…I used kmail and it fails when it tries to send. Its able to receive just fine.

It errors out with:

Sending Failed:
8.0.0.100:Unknown error

Look in /var/log/mail for more details.

I would recommend you to take a look into qmail and postfix, any of those is a better alternative to sendmail in my humble opinion. Also depends on the number of users you plan to serve.

In the past I’ve use qmail (ldap patched) to server 4 million+ users and it run quite good. I don’t know the state of sendmail nowadays, but monolithic has always been something that I really don’t like.

OK. That wasn’t clear. In that case you don’t need a smarthost. Forget about /etc/mail/transport. Sorry.

This is actually postfix

rpm -ql postfix | grep sendmail
>
/usr/lib/sendmail
/usr/sbin/sendmail
/usr/share/man/man1/sendmail.1.gz

Also remove the line

transport_maps = hash:/etc/postfix/transport

from /etc/postfix/main.cf if it is stil there. (sorry again!) and restart sendmail.