PHP SMTP authentication

Hello Experts.

What is the easiest way to send email through PHP with SMTP authentication? Is it PEAR?

BONUS: Would I be able to use it from my localhost, where I don't have a Mail server. (not mandatory)
APD TorontoSoftware DeveloperAsked:
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.

Dave BaldwinFixer of ProblemsCommented:
Generally, it is PHPMailer or SwiftMailer  They can be used from 'localhost' but like any email, you do have to connect to a SMTP server to send email.  They are not a substitute for a server.  By the way, Gmail does not like these programs.  Gmail wants a more sophisticated authentication.

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
Fully agree with Dave - PHPMailer is extremely easy to implement and works great. I think PHPMailer supports GMail's auth via a 3rd party package nowadays...
Also, for what it's worth, -all- SMTP clients work in the same manner, in that they run from your local computer and connect to a mail server (either remote or local), and tell the mail server about the message you want to send. Outlook, Thunderbird, PHPMailer, Swiftmailer, etc...

Just keep email delivery rules in mind (SPF, etc) so you don't accidentally get flagged as a spammer.
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

APD TorontoSoftware DeveloperAuthor Commented:
Could I get a sample script of PHP Mailer that uses a password? As well, is it safe if I have a contact form that asks for a email address to use that as the sent from so the replier can just hit "Reply"?
Dave BaldwinFixer of ProblemsCommented:
Yes, PHPMailer comes with samples, just download it.  Entering an email address to use as the From may not work so well.  The 'From' address is usually part of the authentication along with the password for that account.  Remember, these programs are not mail servers, they are methods to use mail servers instead of using the PHP mail() command.
APD TorontoSoftware DeveloperAuthor Commented:
Thank you guys.
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.