Solved

PHP mail function

Posted on 2007-04-03
7
142 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

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!

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

617 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