Is it possible to send mail in core php via gmail smtp without using any external class?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
I don't think it is possible because you need to perform an authentification. Also, you need to connect via an SSL socket, I don't know if the stock
mail()
function support this.If you are willing to use the Pear Mail package, you might want to take a look at this:
Send email using the GMail SMTP server from a PHP page
It is possible, although you have to modify php.ini settings, see the PHP manual. You can modify php.ini settings at runtime with ini_set
you can do this by PHPmailer Library it already having gmail.php file .
just open and place your detail in that file , you can also use the similar code in your file .
You must make setting in your gmail account setting to allow smtp mailing
There's a lot of miscommunication about this. It is 100% possible to send emails using gmail via PHP's simple "mail()" command. And it is 100% easy.
Install SSMTP:
Edit its settings file:
Inside, make it similar to this, but with your own credentials:
Lastly, open your php.ini, and search for sendmail_path and use this value:
That's it! Test it out in your PHP, with the simple 1-line mail function:
Update on Gmail Security
Gmail now blocks this by default. You can still do this by visiting: http://www.google.com/settings/security/lesssecureapps
Turn this feature ON.
If you have access to edit the
php.ini
then you can do something like this:Alternatively you can do: