Using PHP mail function.

Posted on 2006-05-02
Last Modified: 2006-11-18
Im trying to use the PHP mail function but get an error saying failed to connect to mail server, verify your smtp settings...... I havent changed the settings in php.ini file, do they need to be changed?

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

; For Win32 only.
;sendmail_from =

Question by:generali
    LVL 17

    Accepted Solution

    Right now SMTP says that your mail server is localhost, meaning on the computer.  Is that true?  If you are not runnign a mail server it is liekly that your ISP does run one, browse around and see if u can use a public one that your ISP provides.

    Joe P
    LVL 2

    Author Comment

    Im trying to do it a laptop, my ISP is AOL and web server is apache. im a little unsure what you mean regarding a public mail server? another issue would be that im going to be presenting this and will be connected to a diferent network so not using aol?
    LVL 2

    Author Comment

    Ive been looking at some other feeds and downloaded (what i think is) a mail server from but now i dont know what i need to change in the php.ini file and what to, to allow the mail() function to work?

    Any hints?
    LVL 49

    Assisted Solution


    You can find your smtp server for example by looking into the account settings you have on your outlook or outlook express or other mail software. You probably have defined an outgoing mailserver (SMTP). I don't know which smtp AOL uses.


    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    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…

    728 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

    17 Experts available now in Live!

    Get 1:1 Help Now