Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP mail using Gmail

Tags:

php

email

gmail

In my PHP web app, I want to be notified via email whenever certain errors occur. I'd like to use my Gmail account for sending these. How could this be done?

like image 972
Dinah Avatar asked Aug 30 '08 16:08

Dinah


People also ask

Can you use PHP in email?

PHP's built-in mail() function is one of the simplest ways to send emails directly from the web server itself. It just takes three mandatory parameters: the email address, email subject and message body—and sends it to the recipient.


1 Answers

Gmail's SMTP-server requires a very specific configuration.

From Gmail help:

Outgoing Mail (SMTP) Server (requires TLS)
 - smtp.gmail.com
 - Use Authentication: Yes
 - Use STARTTLS: Yes (some clients call this SSL)
 - Port: 465 or 587
Account Name:   your full email address (including @gmail.com)
Email Address:  your email address ([email protected])
Password:     your Gmail password 

You can probably set these settings up in Pear::Mail or PHPMailer. Check out their documentation for more details.

like image 98
Javache Avatar answered Oct 26 '22 02:10

Javache