gmail


How to Use Gmail to Send Email with Postfix on Ubuntu

Introduction

In today’s digital age, email has become integral to our personal and professional lives. While numerous email clients are available, Gmail remains a popular choice due to its user-friendly interface and powerful features. In this blog post, we will guide you through configuring Postfix, a famous mail transfer agent (MTA), to send emails using your Gmail account on an Ubuntu system. Let’s dive in!

Prerequisites:

Before we begin, make sure you have the following prerequisites in place:

  1. An Ubuntu system with administrative privileges.
  2. A Gmail account.
  3. A basic understanding of the Linux command line.

Step 1: Install Postfix

  1. Open the terminal on your Ubuntu system.
  2. Update the package lists by running the command:
sudo apt update;

Install Postfix by running the command:

sudo apt install postfix;

During the installation process, you will be prompted to configure Postfix. Select “Internet Site” and press Enter. Provide your system’s mail name when prompted.

Step 2: Configure Postfix to Use Gmail

Open the main Postfix configuration file using a text editor:

sudo nano /etc/postfix/main.cf;

Locate the following lines and modify them as shown below:

relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous

Save the changes and exit the text editor.

Step 3: Configure Gmail Account Credentials

Create a file to store your Gmail account credentials:

sudo nano /etc/postfix/sasl_passwd;

Add the following line to the file:

[smtp.gmail.com]:587 [email protected]:your_app_password

Note: Replace “[email protected]” with your actual Gmail address and “your_app_password” with the application-specific password you generated for Postfix in your Google Account settings. Save the file and exit the text editor. Secure the credentials file by running the command:

sudo chmod 600 /etc/postfix/sasl_passwd;

Update the Postfix lookup table for the credentials file by running the command:

sudo postmap /etc/postfix/sasl_passwd;

Step 4: Restart Postfix and Test

Restart the Postfix service to apply the changes:

sudo systemctl restart postfix;

Test the email configuration by sending a test email using the following command:

echo "This is a test email." | mail -s "Test Email" [email protected];

Note: Replace “[email protected]” with the email address where you want to send the test email.

Check the recipient’s mailbox to ensure the test email was delivered successfully.

Conclusion

By configuring Postfix to use Gmail on your Ubuntu system, you can harness the power of both platforms to send emails seamlessly. This integration allows you to leverage Gmail’s advanced features while benefiting from Postfix’s reliability and customization options. With the steps outlined in this blog post, you can easily set up the connection and streamline your email communication. Happy emailing!


Hikvision DVR sending email over GMail

Recently, we were trying to setup the email configuration of a Hikvision DVR which even though it was updated to the latest firmware we would get the message Testing Failed when trying to send an email over GMail.

In the GUI of the DVR there was an option to Enable SSL but no option to enable TLS/STARTTLS. So after consulting the GMail official documentation on how to configure an email client for GMail, we set the SMTP Port to 465 and enabled the SSL option. Then we created an application password for the DVR and tried to test the settings. To our disappointment we got the Testing Failed message.

After reading the latest user manual of the DVR, it mentioned an option to Enable SSL/TLS but not Enable SSL which got us curious. It raised the following question to us: “What if they enabled the TLS functionality but they forgot to update the GUI to match it?”. So we changed the port to 587 and hit Test again.

Guess what ?

It worked!!

It appears that Hikvision enabled the TLS/STARTTLS functionality but forgot to make their GUI reflect the change!

Using the settings depicted in this photo, we were able to send test messages from our Hikvision DVR over GMail using TLS/STARTTLS on port 587 of smpt.gmail.com!
The confirmation of the successful email sending operation.
“TESTING SUCCEEDED.”

A very important note

In the password field, we did not use the password of the Gmail account! We used an Application Password! It is crucial that you activate 2-factor authentication and then create an application password, or else you will not succeed in logging in on your Gmail through your HikVision DVR/NVR.


Samsung Galaxy: Move device contacts to Google (GMail) account

The following guide is a step by step tutorial on how to make move your phone device contacts to your Google (GMail) account.

Step 0: Start the ‘Contacts’ Application

Start the 'Contacts' Application

Start the ‘Contacts’ Application

Step 1: Press the Menu button on your phone and press on ‘Move Device Contacts to’

Press the Menu button on your phone and press on 'Move Device Contacts to'

Press the Menu button on your phone and press on ‘Move Device Contacts to’

Step 2: Select ‘Google’

Select 'Google'

Select ‘Google’

Step 3: Press ‘OK’

Press 'OK'

Press ‘OK’

Step 4: Select the account where you want to move your device contacts to

Select the account where you want to move your device contacts to

Select the account where you want to move your device contacts to