Solved

PHP mail function

Posted on 2007-04-03
7
141 Views
Last Modified: 2008-02-01
Hi

I am running Apache and using PHP.  I want to use the mail function within PHP but I am getting the 'failed to connect to mailserver' etc error message.  What do I need to do to get this working?

Many thanks
0
Comment
Question by:kenabbott
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 18841986
You need to edit php.ini and look for the mail settings. Then restart your apache.

Are you using windows or *x

-r-
0
 

Author Comment

by:kenabbott
ID: 18842150
Yes I'm on Windows.  What do I need to change in php.ini?
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 18842161
Look for your smtp_host setting

-r-
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kenabbott
ID: 18842188
Sorry, I've not done this before.  Is this what I'm looking for?

[mail function]
; For Win32 only.
SMTP = localhost

And do I need to change the smtp setting to my ISPs smtp?

Thanks for your help
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 18842193
Yes, that is the right directive. You need indeed set it to your ISP's or hosting providers SMTP.

-r-
0
 

Author Comment

by:kenabbott
ID: 18842284
Hi

I've set my local php.ini file to the same settings as my hosts php.ini but I am getting

Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for info@rwsd.co.uk

where the latter is the email address I'm trying to send to

Any ideas?

Many thanks

Ken
0
 
LVL 49

Accepted Solution

by:
Roonaan earned 500 total points
ID: 18842295
SMTP servers commonly only allow pc's/applications running in their own network to use their services. As your local webserver is not running from the hostings's serverpark the SMTP will deny access/deny relay.
For your local system you might therefor need to lookup your access providers SMTP from your email client, and use that one.

Kind regards

-r-
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question