Set up sendmail to relay to my ISP's SMTP server

I am setting up a prototype web site on a linux server at home. I want to use the php mail function to send email. I have set the appropriate values in the php.ini for sendmail (I think). However, my ISP is bouncing mail with a specific error message. In checking their web site, they give the remedy for this problem as "setting up your mail client to point to their SMTP server."

How is this done for sendmail?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sendmail is not an e-mail client, which is your problem.  Your PHP script should be setup to send the mail using your ISP smtp server.
jasimon9Author Commented:
I was just using the built-in mail function. How do you set that up to work with my ISP smtp server?
jasimon9Author Commented:
Aha, I bet it could be just setting SMTP = smtpservername in php.ini. I will try that next.
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Yes,  in the [mail function] section change the value of smtp to the name of your ISP's smtp gateway.
jasimon9Author Commented:
This still does not work. I have tried various combinations for sendmail_path and SMTP in php.ini, and everything still bounces back.
I'll have to look at the php.ini doc, but I don't think that you should even be using sendmail.

sendmail will act as if it is a SMTP server itself.

Did you change the SMTP= parameter to point to your ISP's SMTP server?

Who is bouncing what back?
jasimon9Author Commented:
Yes, I first changed it to the "windows style" of just using SMTP=smtpservername and leaving sendmail_path blank. That did not work. So I added the sendmail_path back pointing at sendmail.

Here is the bounced mail from the root mail box, which shows the response from my ISP. The interesting part is the reference to, which explains that the solution is to relay the mail to the ISP's smtp server, which is what we are now trying to do without success.

From MAILER-DAEMON@localhost.localdomain  Sat Jul  9 22:33:01 2005
Return-Path: <MAILER-DAEMON@localhost.localdomain>
Received: from localhost (localhost)
      by localhost.localdomain (8.12.5/8.12.5) id j6A3X1ri001386;
      Sat, 9 Jul 2005 22:33:01 -0500
Date: Sat, 9 Jul 2005 22:33:01 -0500
From: Mail Delivery Subsystem <MAILER-DAEMON@localhost.localdomain>
Message-Id: <200507100333.j6A3X1ri001386@localhost.localdomain>
To: <nobody@localhost.localdomain>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message


The original message was received at Sat, 9 Jul 2005 22:32:57 -0500
from barebones []

   ----- The following addresses had permanent fatal errors -----
    (reason: 550 5.7.1 Mail Refused - - See

   ----- Transcript of session follows -----
... while talking to
>>> MAIL From:<nobody@localhost.localdomain>
<<< 550 5.7.1 Mail Refused - - See
554 5.0.0 Service unavailable

Content-Type: message/delivery-status

Reporting-MTA: dns; localhost.localdomain
Received-From-MTA: DNS; barebones
Arrival-Date: Sat, 9 Jul 2005 22:32:57 -0500

Final-Recipient: RFC822;
Action: failed
Status: 5.7.1
Diagnostic-Code: SMTP; 550 5.7.1 Mail Refused - - See
Last-Attempt-Date: Sat, 9 Jul 2005 22:33:01 -0500

Content-Type: message/rfc822

Return-Path: <nobody@localhost.localdomain>
Received: from localhost.localdomain (barebones [])
      by localhost.localdomain (8.12.5/8.12.5) with ESMTP id j6A3Wvri001384
      for <>; Sat, 9 Jul 2005 22:32:57 -0500
Received: (from nobody@localhost)
      by localhost.localdomain (8.12.5/8.12.5/Submit) id j6A3Wuug001382;
      Sat, 9 Jul 2005 22:32:56 -0500
Date: Sat, 9 Jul 2005 22:32:56 -0500
Message-Id: <200507100332.j6A3Wuug001382@localhost.localdomain>
Subject: Registration Confirmation

Thank you for registering at  Click this link to confirm your registration:


Once you see a confirmation message, you will be logged into


What smtp server name are you coding on the SMTP= parameter?

Are you a business customer of Road Runner or are you a residential  customers?

When you are sending the e-mail what is the:

     FROM address
    TO address

I would assume that in order for Road Runner to prevent some SPAM through their SMTP servers that the FROM address at minumun must be the same as what your e-mail domain is.  That is if your e-mail address is your from address in the e-mail must either be or

Also the TO address, of course, must be a valid to address, but you should be able to put in any valid TO address.

If I am reading your post correctly you are attempting to send e-mail from:

and you are attempting to send it to:

If I am reading their (Road Runner's) e-mail policy the SMTP server you are talking to is a "outbound" smtp server.  Which means it is used to send e-mail OUT from RoadRunner's residential customers.  Again, this may mean that they most likely have set it up so that the from address must be (most likley a vaild e-mail address in the space) and the to address can be any valid address.

I think what you're after is setting sendmail to relay via your providers outbound server. This then causes ALL outbound emails that are handled through sendmail to be sent via the ISP's SMTP relay, which should then avoid the error message you're getting.

Look in /etc/mail/ (or sometimes /etc/
Then find the entry:
# "Smart" relay host (may be null)

Uncomment the DS line and add in your ISPs mail relay:

# "Smart" relay host (may be null)

Restart sendmail (/etc/init.d/sendmail restart    or similar) and then try again. Since PHP generally relays its mail via the local server's sendmail, this should solve your problem.

jasimon9Author Commented:
Still does not work.

php code:

    mail ('', 'Confirmation', 'TestBody', 'From:');

ISP's smtp server:

In php.ini:
sendmail_path = /usr/sbin/sendmail -t
sendmail_from =


Error message from ISP:
Action: failed
Status: 5.1.8
Diagnostic-Code: SMTP; 553 5.1.8 <nobody@localhost.localdomain>... Domain of sender address nobody@localhost.localdomain does not exist

jasimon9Author Commented:
I have managed to get a workaround sending email.

I changed the sendmail_path in php.ini, adding the -f parameter:

    /usr/bin/sendmail -t -f

where is replaced by my actual email account with my ISP.

While this approach will get me past the current bottlemeck, it is only a workaround, as I need the usual ability to specify the "from" address in a way other than hard coding it into the php.ini file.
jasimon9Author Commented:
It looks like I can also override the hardcoded from using the 4th parameter to the php mail command, as follows:

    mail ('', 'Test Subject', 'Test Body', 'From:');

This still feels like a workaround, and I did not find the -f parameter suggested anywhere, except from my reading of the sendmail man page.

Please advise if there is a more appropriate solutiion. In the meantime, it appears that this workaround will do the job for now.
You will need to have the sending e-mail address be a vaild e-mail address.  Road Runner is validating the sending address to prevent SPAM.

More and more ISP's are working to prevent SPAM, so they normaly have two "sets" of SMTP server.  One for inbound, for which all e-mails must be TO an e-mail address for one of the domains they receive e-mail for.

The other one is for outbound e-mails, for which all e-mails must have a FROM address of one of their e-mail domains and also must come from one of the IP addresses that are theirs.

Some ISP (mine for instances) do not allow you to directly connect to other SMTP servers (at least not using the standard port 25) through them unless you have a business class service.  That means I can't run my own SMTP server at my house.
jasimon9Author Commented:
It appears that my own answer on 07/11/2005 is the best I am going to get. So I am requesting PAQ and close.

PAQd, 250 points refunded.

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Protocols

From novice to tech pro — start learning today.