sendmail help

I'm trying to get sendmail set up in my debian install. I used Apt to install Apache and PHP - how would I use to to install sendmail and incorporate it into PHP?

14 Replies

Why in the world are you punishing yourself with sendmail?

Well what other options are available?

@TheZach:

Well what other options are available?

If you're using the Debian disk image from Linode, you probably already have exim4 installed.

Or you can install postfix, currently the most popular MTA.

apt-get install postfix

Whats MTA mean?

And if I have exim4 how would I tell? And if so how would I incorporate it into my PHP?

MTA means mail transfer agent. It's a program that takes care of receiving and sending emails to and from your server. Sendmail, exim4, postfix, etc. are different kinds of MTA's. You only need one of them.

In order to tell if exim4 (or postfix, or anything else) is installed, try

apt-get install exim4

If it tells you that exim4 is already installed, then it is. If not, the command above will automatically install it for you. Same goes for sendmail/postfix/etc. Just replace the last word with the name of the program you want to install.

What do you mean, incorporating mail into PHP? If you mean sending welcome emails, password reminders, etc. from your blog/forum software, all you need to do is to install the MTA, and PHP takes care of the rest. There's no need to manually put the two together. On Debian, these things just work out of the box.

If you do install an MTA on your server, and you're only going to use it for sending emails from PHP, you must make sure that your port 25 is unreachable from the outside. Otherwise, bad people could send spam using your server!

I installed exim4 and PHP still wont send emails

Did you update sendmail_path in your php.ini? it points to /usr/sbin/sendmail by default.

The simple fix is to create a symbolic link.

ln -s /usr/sbin/sendmail /usr/sbin/exim

Then you won't need to update the php.ini. I'm guessing on the exim binary path as I don't use exim.

@Deviation:

Did you update sendmail_path in your php.ini? it points to /usr/sbin/sendmail by default.

The simple fix is to create a symbolic link.

ln -s /usr/sbin/sendmail /usr/sbin/exim

Then you won't need to update the php.ini. I'm guessing on the exim binary path as I don't use exim.

exim4 already has '/usr/sbin/sendmail' - all MTA packages install it for compatibility reasons.

> I installed exim4 and PHP still wont send emails

Heard of a log report? What errors, etc. You may need to enable debugging in your PHP script.

2009-01-07 09:01:22 1LKYyI-0007b9-Te <= [email protected] U=www-data P=local S=1346 [email protected] 2009-01-07 09:01:23 1LKYyI-0007b9-Te ** [email protected]: Unrouteable address 2009-01-07 09:01:23 1LKYyJ-0007bB-2q <= <> R=1LKYyI-0007b9-Te U=Debian-exim P=local S=2175 2009-01-07 09:01:23 1LKYyI-0007b9-Te Completed 2009-01-07 09:01:23 1LKYyJ-0007bB-2q => www-data <[email protected]>R=local_user T=mail_spool 2009-01-07 09:01:23 1LKYyJ-0007bB-2q Completed</[email protected]>

So you're trying to send an email to [email protected], and exim is telling you that it has no idea where to send that email.

1. The public DNS records for thezach.net shows that the one and only MX record for your domain thezach.net is smtp.digitalexample.net. Is this the email hosting company that you're using? If so, is smtp.digitalexample.net the correct MX record to be using?

2. Does your server think that its hostname is thezach.net? The first line of your log suggests that it does. In that case, exim will think that [email protected] is a local email address. It will try to deliver the email to the mailbox of a local user named zach. Not what you want! (I'm assuming that you don't want to use your Linode to read emails, since you're outsourcing your email to another company.) Change your hostname to a subdomain and try again. You'll also need to go through exim's configuration files to update the hostname.

If it helps, this was his original request: http://www.linode.com/forums/viewtopic.php?t=3791

Basically trying to forward email to his exchange servers.

Ok, I changed my hostname to server1.thezach.net

The latest error:

2009-01-07 12:42:29 1LKcQH-0000Sc-7I <= [email protected] U=www-data P=local S=574 [email protected]
2009-01-07 12:42:29 1LKcQH-0000Sc-7I smtp.digitalexample.com [69.51.128.242] Connection refused
2009-01-07 12:42:29 1LKcQH-0000Sc-7I ** [email protected] R=dnslookup T=remote_smtp: SMTP error from remote mail server after HELO 127.0.0.1 localhost: host smtp.digitalexample.com [69.51.128.243]: 501 5.5.4$
2009-01-07 12:42:29 1LKcQH-0000Sf-Us <= <> R=1LKcQH-0000Sc-7I U=Debian-exim P=local S=1546
2009-01-07 12:42:30 1LKcQH-0000Sc-7I Completed
2009-01-07 12:42:30 1LKcQH-0000Sf-Us ** [email protected]: Unrouteable address
2009-01-07 12:42:30 1LKcQH-0000Sf-Us Frozen (delivery error message)

Looks like a DNS lookup issue. Do you have server1.thezach.net pointed to your linode's IP? Need a DNS entry in thezach.net zone for server1…

As Deviation said, your DNS is not setup correctly. See http://support.microsoft.com/kb/291828

$ dig server1.digitalexample.com

; <<>> DiG 9.3.4-P1.1 <<>> server1.digitalexample.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 61332
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;server1.digitalexample.com.    IN      A

;; AUTHORITY SECTION:
digitalexample.com.     3600    IN      SOA     cluster1node1.internal.digitalex
ample.com. adevries.digitalexample.com. 2006122165 900 600 3600 3600

;; Query time: 369 msec
;; SERVER: 207.192.69.5#53(207.192.69.5)
;; WHEN: Wed Jan  7 19:40:44 2009
;; MSG SIZE  rcvd: 112

i.e. the host can't be resolved

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct