LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-16-2009, 02:58 PM   #1
rwcooper
Member
 
Registered: Mar 2006
Posts: 45

Rep: Reputation: 15
Configure sendmail to send email out through my ISP


Hi,

I am running sendmail 8.14.2 under Slackware 12.1. I want to configure sendmail so that I can send email from PHP scripts using the mail() function. I want this to be a send email only configuration. I have modified the cf file to specify my ISP as the SMART_HOST. If I enter:

sendmail -bv myname@mts.net

I get the following response:

myname@mts.net... deliverable: mailer relay, host smtp.mts.net, user myname@mts.net

PHP is configured to use /usr/bin/sendmail -t -i

When I try to send email using the mail() function of PHP I get the following:

Jun 16 13:01:11 myhost sendmail[3675]: n5GI1B4L003675: to=myname@mts.net, ctladdr=apache (80/80), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30160, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

Why is localhost [127.0.0.1] the relay? Why would it be refusing a connection when I'm trying to send email out from localhost?

Here is the content of my sendmail.mc file which I used to generate my sendmail.cf file:

dnl# This is the default sendmail .mc file for Slackware. To generate
dnl# the sendmail.cf file from this (perhaps after making some changes),
dnl# use the m4 files in /usr/share/sendmail/cf like this:
dnl#
dnl# cp sendmail-slackware.mc /usr/share/sendmail/cf/config.mc
dnl# cd /usr/share/sendmail/cf
dnl# sh Build config.cf
dnl#
dnl# You may then install the resulting .cf file:
dnl# cp config.cf /etc/mail/sendmail.cf
dnl#
include(`../m4/cf.m4')
VERSIONID(`default setup for Slackware Linux')dnl
OSTYPE(`linux')dnl
dnl# These settings help protect against people verifying email addresses
dnl# at your site in order to send you email that you probably don't want:
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
dnl# Uncomment the line below to send outgoing mail through an external server:
define(`SMART_HOST',`smtp.mts.net')dnl
dnl# No timeout for ident:
define(`confTO_IDENT', `0')dnl
dnl# Enable the line below to use smrsh to restrict what sendmail can run:
dnl FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
dnl# See the README in /usr/share/sendmail/cf for a ton of information on
dnl# how these options work:
FEATURE(`use_cw_file')dnl
FEATURE(`use_ct_file')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
FEATURE(`access_db', `hash -T<TMPF> /etc/mail/access')dnl
FEATURE(`blacklist_recipients')dnl
FEATURE(`local_procmail',`',`procmail -t -Y -a $h -d $u')dnl
FEATURE(`always_add_domain')dnl
FEATURE(`redirect')dnl
dnl# Turn this feature on if you don't always have DNS, or enjoy junk mail:
dnl FEATURE(`accept_unresolvable_domains')dnl
EXPOSED_USER(`root')dnl
dnl# Also accept mail for localhost.localdomain:
LOCAL_DOMAIN(`localhost.localdomain')dnl
MAILER(local)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl

If it matters I do not have a local domain name. Could the problem be the last few lines in the above file? If so, what should they be?

What other info do I need to supply in order for you help?

Thanks,
Randy
 
Old 06-16-2009, 03:35 PM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,028
Blog Entries: 5

Rep: Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791
You have to allow relay to the IP configured for your NIC:

In your sendmail.mc (likely in /etc/mail) you should see a line like:
Code:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
Below that you need to add a similar line that specifies your IP. If your IP is 10.30.22.5 you'd add:
DAEMON_OPTIONS(`Port=smtp,Addr=10.30.22.5, Name=MTA')dnl

You would then need to compile the mc file into the cf file. Check to be sure you have sendmail-cf package installed in addition to the sendmail package. To compile you type:

make <directory of mail files> e.g. make /etc/mail. This will create a new sendmail.cf file from the sendmail.mc.
 
Old 06-16-2009, 03:49 PM   #3
rwcooper
Member
 
Registered: Mar 2006
Posts: 45

Original Poster
Rep: Reputation: 15
Thanks for your reply. I don't have any DAEMON_OPTIONS lines in my sendmail.mc file. Does it matter where I place these lines in the file?

Thanks,
Randy
 
Old 06-16-2009, 04:00 PM   #4
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,028
Blog Entries: 5

Rep: Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791Reputation: 791
Hmmm - it may be you have a precanned sendmail.cf:

Do you have a this in sendmail.cf?
Code:
O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
If so then just add a line like it with your IP and do NOT do the make I mentioned e.g.:
Code:
O DaemonPortOptions=Port=smtp,Addr=10.30.22.5, Name=MTA
Stop and restart sendmail afterwards.
 
Old 06-16-2009, 04:15 PM   #5
rwcooper
Member
 
Registered: Mar 2006
Posts: 45

Original Poster
Rep: Reputation: 15
Hi,

No, this is what I have in the sendmail.cf file:

# SMTP daemon options
O DaemonPortOptions=Name=MTA
O DaemonPortOptions=Port=587, Name=MSA, M=E

I am using Slackware 12.1 and it comes with a file named
sendmail-slackware.mc which appears to be non-standard.

Thanks,
Randy
 
Old 06-16-2009, 07:28 PM   #6
rwcooper
Member
 
Registered: Mar 2006
Posts: 45

Original Poster
Rep: Reputation: 15
Thumbs up Problem solved.

Hi,

It turns out I had to add a fully qualified name for my host in /etc/hosts. I was getting a data format error from my ISP.

Thanks for your help.

Randy
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moved server to new ISP, now sendmail won't send BigFunkyChief Linux - Server 6 12-01-2007 10:23 AM
send email with sendmail from out stigmata Linux - Software 1 12-20-2005 03:35 PM
how to send all mail through isp server with sendmail or? dlm4444 Linux - Wireless Networking 1 07-06-2005 05:07 PM
Using sendmail to send mail from your ISP nrmx Linux - Software 2 12-16-2004 01:43 PM
Sendmail Can't Send Mail To My Isp Account paperdiesel Linux - Software 5 04-14-2004 12:12 PM


All times are GMT -5. The time now is 05:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration