Solved

PHP mail function

Posted on 2007-04-03
7
135 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
  • 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now