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
Solved

PHP mail function

Posted on 2007-04-03
7
138 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 Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Currency in SQL? 2 30
php help 34 58
IP 10.0.1.2 / 255.0.0.0 61 56
How to eliminate "realname" and "email" from formMail.php (tectite.com) results. 3 31
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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 dynamically set the form action using jQuery.

840 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