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?
jasimon9Asked:
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.

giltjrCommented:
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.

giltjrCommented:
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.
giltjrCommented:
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 http://security.rr.com/rrDynamic.htm, 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;
      boundary="j6A3X1ri001386.1120966381/localhost.localdomain"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message

--j6A3X1ri001386.1120966381/localhost.localdomain

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

   ----- The following addresses had permanent fatal errors -----
<tmp4@mn.rr.com>
    (reason: 550 5.7.1 Mail Refused - res.rr.com - See http://security.rr.com/rrDynamic.htm)

   ----- Transcript of session follows -----
... while talking to kcmx03.mgw.rr.com.:
>>> MAIL From:<nobody@localhost.localdomain>
<<< 550 5.7.1 Mail Refused - res.rr.com - See http://security.rr.com/rrDynamic.htm
554 5.0.0 Service unavailable

--j6A3X1ri001386.1120966381/localhost.localdomain
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; tmp4@mn.rr.com
Action: failed
Status: 5.7.1
Diagnostic-Code: SMTP; 550 5.7.1 Mail Refused - res.rr.com - See http://security.rr.com/rrDynamic.htm
Last-Attempt-Date: Sat, 9 Jul 2005 22:33:01 -0500

--j6A3X1ri001386.1120966381/localhost.localdomain
Content-Type: message/rfc822

Return-Path: <nobody@localhost.localdomain>
Received: from localhost.localdomain (barebones [127.0.0.1])
      by localhost.localdomain (8.12.5/8.12.5) with ESMTP id j6A3Wvri001384
      for <tmp4@mn.rr.com>; 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>
To: tmp4@mn.rr.com
Subject: Registration Confirmation
From: noreply@erephunter.com

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

http://localhost/confirm.php?hash=f2104f38224ceb5c489056e4c00dded4&email=tmp4%40mn.rr.com

Once you see a confirmation message, you will be logged into Example.com

--j6A3X1ri001386.1120966381/localhost.localdomain--

giltjrCommented:
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 johndoe@mn.rr.com your from address in the e-mail must either be somthing@mn.rr.com or johndoe@mn.rr.com.

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:

     noreply@erephunter.com

and you are attempting to send it to:

     tmp4@mn.rr.com

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 @mn.rr.com (most likley a vaild e-mail address in the @mn.rr.com space) and the to address can be any valid address.

andy20Commented:
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/sendmail.cf (or sometimes /etc/sendmail.cf)
Then find the entry:
# "Smart" relay host (may be null)
#DS

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

# "Smart" relay host (may be null)
DSmailrelay.myisp.com

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 ('jas@rephunter.net', 'Confirmation', 'TestBody', 'From: noreply@mn.rr.com');

ISP's smtp server: smtp-server.mn.rr.com

In php.ini:
sendmail_path = /usr/sbin/sendmail -t
sendmail_from = js9@mn.rr.com
SMTP = smtp-server.mn.rr.com

In sendmail.cf:
DSsmtp-server.mn.rr.com

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 me@mydomain.com

where me@mydomain.com 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 ('jas@rephunter.net', 'Test Subject', 'Test Body', 'From: jasimon8@mn.rr.com');

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.
giltjrCommented:
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.

GhostModCommented:
PAQd, 250 points refunded.

GhostMod
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.