Home Email How to Setup Free Gmail SMTP For Your Domain Mail

How to Setup Free Gmail SMTP For Your Domain Mail

24
0
How to Setup Free Gmail SMTP For Your Domain Mail
How to Setup Free Gmail SMTP For Your Domain Mail

CDN BIZHow to Setup Free Gmail SMTP For Your Domain Mail. How to set Gmail SMTP is quite easy to do with just a few simple steps. Not everyone knows that they can benefit from Google’s free SMTP server, which is available for sending e-mails.

This can be the perfect solution for users who are unable to use the SMTP server of the internet and hosting service providers and have various problems sending emails.

In this tutorial, we will review how to use Gmail’s free SMTP server. You can also find detailed e-mail instructions via PHP mail.

Benefits of Using External SMTP Service

Here are some of the benefits of using an external SMTP service.

  • E-mail can be confirmed to be delivered to the destination.
  • You don’t need to set up a server (if you are using a VPS).
  • Servers are rarely blacklisted, so it is unlikely that your email will go as SPAM.

Email Sending Limit with Gmail SMTP

The email sending limit provided by SMTP Gmail is 100 emails per day. If you have reached the limit, then you cannot send an email for the next 24 hours until it is reset automatically.

What You Need When Using Gmail SMPT

Before proceeding to the instructions on how to set Gmail SMTP, here are what you need:

  • Gmail or G Suite or Google Workspace account.
  • Access to your hosting control panel.

How to Free Gmail SMTP Settings

Step 1: Get Google SMTP Server Settings

To use the SMTP server from Google, you first need to open Less secure apps access. Google started blocking applications and devices deemed not using modern security standards. To avoid this, please activate your Less secure apps account first at the following link.

Apps Google Less Secure
Apps Google Less Secure

IMPORTANT: If 2-step verification of your Google account is active, then less secure apps cannot be activated. In this case, you will need to log in using an app password.

Here are the Google SMTP details:

  • SMTP Server: smtp.gmail.com
  • SMTP Username: your email address, for example [email protected]
  • SMTP Password: Your Gmail password
  • SMTP Port: 465
  • TLS / SSL: Required

If you want to take advantage of the IMAP protocol and store all outgoing e-mails in sent e-mail folders within Gmail, please follow these steps.

1. Login to your Gmail account and please click on the Settings menu.

Gmail Setting
Gmail Setting

2. Select the Forwarding and POP / IMAP tab and click Enable IMAP as shown in the image below.

IMAP Gmail
IMAP Gmail

3. Please click the Save Changes button at the bottom.

Step 2: Using Google SMTP with PHP Mail

In this step, you will learn how to set up smtp Gmail for sending email using PHP mail. Knowing how to send an email using PHP will come in quite handy when you are learning to code or just want to build a contact form for a website.

There are many php mail scripts available, in the example below we’ll use PHPMailer:

1. Please open the PHPMailer repository on GitHub, then download the script via the Clone or download menu> Download ZIP. Please save it on your computer.

phpmail at github
phpmail at github

2. Please upload the file into your hosting. To upload it, you can use an FTP client such as FileZilla or a file manager that is already available on your hosting panel.

PHPMailer already has a sample configuration file named gmail.phps for use with Google’s SMTP servers. The file is in the PHPMailer-master / examples folder. Please edit the script, adjust it to your email data, as seen in the script below which is marked in bold:

<? 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 (used for production)
// 1 = client message
// 2 = client and server messages
$ mail-> SMTPDebug = 2;
// HTML-friendly debug output
$ mail-> Debugoutput = 'html';
// 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 SMTP port - 587 to authenticate TLS, a.k.a. RFC4409 SMTP submission
$ mail-> Port = 587;
// Set encryption to use - ssl (deprecated) or tls
$ mail-> SMTPSecure = 'tls';
// SMTP authentication
$ mail-> SMTPAuth = true;
// Username used for SMTP authentication - use gmail email
$ mail-> Username = "[email protected]";
// Password used for SMTP authentication
$ mail-> Password = "your password";
// Email sender
$ mail-> setFrom ('email [email protected] ',' First Last ');
// Alternative reply email address
$ mail-> addReplyTo ('[email protected] ',' First Last ');
// Destination email
$ mail-> addAddress ('[email protected] ',' John Doe ');
// Subject email
$ mail-> Subject = 'PHPMailer GMail SMTP test';
// Reads HTML message content from external file, converts embedded images,
// Converts HTML to basic plain-text
$ mail-> msgHTML (file_get_contents ('contents.html'), dirname (__ FILE__));
// Replace plain text body manually
$ mail-> AltBody = 'This is a plain-text message body';
// Attach the image file
$ mail-> addAttachment ('images / phpmailer_mini.png');
// sending messages, checking for errors
if (! $ mail-> send ()) {
echo "Email Error:". $ mail-> ErrorInfo;
} else {
echo "Message Sent!";
}
Contact GitHub API Training Shop Blog About

In order for the script to work with Google’s SMTP server, you need to edit it and change some settings such as username, password, sender email, and destination email. You also need to rename the gmail.php file to gmail.php so that it can be accessed via a browser. You can use the same file manager or FTP client to archive it.

After you finish editing, please access the script through a browser. If you upload the PHPMailer-master folder into the public_html folder, the link that will be accessed will be like this: http://yourdomain.com/PHPMailer-master/examples. If all the configuration is correct, you will see a success message which means the email message was sent successfully.

Conclusion

Now you can do how to set Gmail SMTP and configure your Google account. Apart from that, you can also send e-mails via PHP mail.

LEAVE A REPLY

Please enter your comment!
Please enter your name here