Configuring Sendmail to use smart host

Dave M G martin at autotelic.com
Wed Jul 4 14:06:15 UTC 2007


Ubuntu Users,

I'm a web developer and not at all a sendmail administrator. But I find 
I'm trying to set up my local LAMP server so that I can test email 
functions from within my PHP scripts.

All I want to be able to do is send email from within PHP. My local LAMP 
server is not serving to the web, it's just for local testing.

But to test email, I need to have SMTP set up so that it can send out to 
the internet.

After much research and frustration, I've learned to do the following:

I need to install sendmail, and configure it so that it uses a "smart 
host", which is the SMTP server of my ISP.

So...

In my /etc/php5/apache2/php.ini file, I have the following setting:

sendmail_path = /usr/sbin/sendmail

My /etc/mail/sendmail.mc file has:

FEATURE(`authinfo',`hash -o /etc/mail/authinfo.db')dnl
define(`SMART_HOST',`smtp.my.isp.com')
define(`SMTP_MAILER_ARGS', `TCP $h 587')    - my ISP takes SMTP 
connections at port 587

And I have a file called /etc/mail/authinfo.db which has in it:
AuthInfo:smtp.my.isp.com "U:mylogin at isp.com" "P:password" "M:PLAIN"
AuthInfo: "mylogin at isp.com" "P:password" "M:PLAIN"

I had to "hash" the authinfo.db file with the following command:
sudo makemap hash /etc/mail/authinfo < /etc/mail/authinfo

I also had to convert(?) the sendmail.mc file to a sendmail.cf file with 
this command:
sudo m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

And then when all that was done, I restarted sendmail like so:
sudo /etc/init.d/sendmail restart

But it said:
sudo: cannot get working directory
Restarting Transport Agent: sendmailstart-stop-daemon: stat 
/usr/sbin/sendmail-mta: No such file or directory (No such file or 
directory)
/etc/init.d/sendmail: 1195: /usr/sbin/sendmail-msp: not found

What have I missed, am I doing something wrong, and, ultimately, how do 
I get sendmail to use my ISP (with username, password, and port 
settings) to send mail from my testing machine?

Thank you for any advice.

-- 
Dave M G
Ubuntu Feisty 7.04
Kernel 2.6.20-15-386




More information about the ubuntu-users mailing list