How to use SMTP Google for FREE

Kaz Wolfe

Well-known member
Joined
Jul 7, 2016
Messages
385
Best answers
0
Ratings
30
Points
28
#1
SMTP Google is the best solution for those who cannot use the ISP's SMTP server or the hosting providers as well as those who have difficulties with email. However, not everyone takes advantage of this advantage. Below, I will show you how to use free SMTP Google, how to send mail via PHP Mailer and WordPress Plugin.

What are the benefits of using the SMTP service?
In addition to the benefits that most hosting providers and ISPs support, the use of SMTP Google has many advantages such as:
  • Your ability to send mail has a much higher success rate
  • No server installation required (if you are using VPS)
  • Your mail is rarely marked as spam
How to use SMTP Google for free?
You need to prepare before starting to use SMTP services including:
  • Gmail or G Suite account
  • Access to the hosting control panel
Step 1: Get SMTP configuration information for Google Mail Server
You can get Google SMTP configuration information here:
SMTP Server: smtp.gmail.com
SMTP Username: Gmail's full name (email address), for example, [email protected]
SMTP Password: Your Gmail password.
SMTP Port: 587
TLS / SSL: Required.


You can also follow these instructions to store all emails sent from Gmail sent:

Log in to your Gmail account => Settings

How to use SMTP Google for FREE 1.jpg

2. Go to Forwarding and POP/IMAP to activate IMAP

How to use SMTP Google for FREE 2.jpg

3. Click Save Changes to complete

Step 2: Use SMTP Google
In this step, you can choose to use SMTP Google to send email via PHP Mailer or WordPress Plugin.

Use WP Mail SMTP Plugin
In our opinion, the easiest way to use SMTP Server on WordPress is to use WP Mail SMTP.
First of all, visit WordPress admin dashboard => Plugins => Add New. Install and activate Wordpress Mail SMTP Plugin.

How to use SMTP Google for FREE 3.jpg How to use SMTP Google for FREE 3.jpg

Then, access Settings of WP Mail SMTP Plugin => Installed Plugins.

Next, go to WP Mail SMTP by going to Plugins => Installed Plugins and clicking Settings.

Here, you will need to fill in all necessary Google Mail Server information:

How to use SMTP Google for FREE 4.jpg

And finally, click Save Changes to save all changes. To make sure the setup is entirely correct, try again by sending a sample email to your other personal email address. Enter your email address and click the Send Test button.

If nothing is wrong, you will receive a template like this which means the plugin has successfully sent the email via Google Mail Server. And if something goes wrong, check your settings and contact your SMTP server or hosting support team for assistance.

Use PHP Mailer
You can use lots of arbitrary PHP script, however, here we will use PHPMailer script:

1. Open the PHPMailer repository on GitHub and download the script by clicking Clone or download -> Download ZIP. Then save your device.

How to use SMTP Google for FREE 5.jpg

2. Upload it to your account via the file manager or FPT client by your hosting provider.

PHPMailer has a sample configuration file gmail.phps for use with Google SMTP. The path is the PHPMailer-master/examples directory.

Code:
<?php
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
// use
// $mail->Host = gethostbyname('smtp.gmail.com');
// if your network does not support SMTP over IPv6
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "[email protected]";
//Password to use for SMTP authentication
$mail->Password = "yourpassword";
//Set who the message is to be sent from
$mail->setFrom('[email protected]', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('[email protected]', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('[email protected]', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer GMail SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}
Contact GitHub API Training Shop Blog About
To use the above script for SMTP Google, you will have to edit the information such as username, password, and email recipient address. You may need to edit the file name from gmail.phps to gmail.php to be accessible. Just use the file manager or FTP client to edit the name.

After that, you need to open the scrip with the browser. If you have uploaded PHPMailer to the public_html directory, the file can be accessed via http://example.com/PHPMailer-master/examples. And if nothing goes wrong, you will receive a message that your email has been sent successfully.

The above post has shown you how to use SMTP Google for free as well as quickly. Thereby, you will also learn how to send email via PHPMailer and WP Mail SMTP Plugin with the information of google mail server.
Good luck!
 

David Beroff

Well-known member
Joined
Jun 14, 2016
Messages
1,076
Best answers
0
Ratings
110 1
Points
63
#2
This way is useful if you use it to send a small amount of emails to your connections but if you you send more emails at the same time, your emails can be failed by Google can temporarily block your email.
 
Latest Threads
Replies
1
Views
12
  • Deleted
  • Deleted by fwh
Replies
0
Views
1
  • Deleted
  • Deleted by fwh
Replies
0
Views
1
  • Deleted
  • Deleted by fwh
Replies
0
Views
1
  • Deleted
  • Deleted by fwh
Replies
0
Views
1
Recommended Threads
Replies
6
Views
1,418
Replies
5
Views
1,232
Replies
20
Views
6,011
Replies
9
Views
557

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top