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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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 https://github.com/PHPMailer/PHPMailer or SwiftMailer http://swiftmailer.org/.  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.
1

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
gr8gonzoConsultantCommented:
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...
0
gr8gonzoConsultantCommented:
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.
0
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

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"?
0
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.
0
APD TorontoSoftware DeveloperAuthor Commented:
Thank you guys.
0
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
PHP

From novice to tech pro — start learning today.