mail function in php


What is needed when using the php function mail to send emails? Email server? Is there any option to use one free? What are the best options?

Thanks in advance.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Normally it's using the local mailer (sendmail).

See the requirements here:

and runtime configuration:

Most of the time you use the mailer on the server you're hosting your website on. Try it and see if it works - it should run without any further configuration.
lulonAuthor Commented:
Note: I'm using Ubuntu
Then I assume you're having problems sending e-mails using the PHP mail() function on your localhost, yes?
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

lulonAuthor Commented:
I haven't even tried yet. I have the code and I know it works cause it has been tested but not in my computer.
Ubuntu does come with a mail server... you can look at for it's features.

Try running this php script on your server, just replace the email adress to your address and if you get it it means that you already have it set up, if you don't then we will go and try to assist you in setting that up for you.

//Change the email to your address
mail("","Testing Mail Function","This is a test message to test the mailing capabilities");


Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lulonAuthor Commented:
I will try to configure it.

But, do you normally have to have any kind of contract or similar with your ISP in order to be able to send emails to another accounts? Is it normally free or does it cost money?
No, with most normal providers you can do what you want. And with Ubuntu you should be able to do it out of the box.
hi ,

mail function working when smtp server is you have mail server then you can implement this and see email.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.