Skip to content
www.mytechnote.ru
Menu
  • Administration
    • Scripts
  • Equipment
    • Reviews
    • Instructions
  • Other
  • English
    • English
    • Русский
Menu

How to Install a Simple SMTP Client (ssmtp) on Ubuntu for Sending Emails from Your Website

In this blog post, we’ll guide you through the simple and speedy process of setting up an SMTP client on your Ubuntu system. This SMTP client will enable you to connect seamlessly to Yandex’s email servers, allowing you to send emails from your website with ease. While many recommend using more robust solutions like Postfix or Sendmail, we believe that for tasks such as sending emails on behalf of a single user, such as website registration and notifications, simpler options like ssmtp are more efficient. Ssmtp is lightweight, easy to configure, supports encryption, and gets the job done exceptionally well.

Let’s dive in.

Setting Up ssmtp on Ubuntu:

Step 1: Installing ssmtp

To begin, open your terminal and install ssmtp with the following command:

sudo apt-get install ssmtp

Step 2: Configuring ssmtp

Now, let’s configure ssmtp by editing its configuration file. Open the configuration file with the following command:

 

sudo nano /etc/ssmtp/ssmtp.conf

In this file, make the necessary edits as shown below:

 

# Email address used as sender
root=site@mytechnote.ru
# Domain from which the emails will appear to come
rewriteDomain=mytechnote.ru
# Yandex server and port
mailhub=smtp.yandex.ru:465
# Your server's hostname
hostname=mytechnote.ru
# Enable TLS encryption
UseTLS=YES
# Yandex authentication
AuthUser=site@mytechnote.ru
AuthPass=yourpassword
# Allow users to customize the "From" field
FromLineOverride=YES

Step 3: Editing revaliases File

Next, edit the revaliases file with the following command:

sudo nano /etc/ssmtp/revaliases

Add lines like these to the file:

 

root:site@mytechnote.ru:smtp.yandex.ru:465
www.mytechnote.ru:site@mytechnote.ru:smtp.yandex.ru:465
www-data:site@mytechnote.ru:smtp.yandex.ru:465

As you can see, the first field is the username, the second is the “From” field, and the third is the SMTP server and port.

 

Step 4: Testing Your Configuration

To test your setup, try sending an email using the following command:

ssmtp sanglyb@mail.ru
# When prompted, provide the following details:
To: vashapochta@mail.ru
From: site@mytechnote.ru
Subject: test
# there should be one empty string

test

After typing the message, press Ctrl+D to send it. Your email should be sent successfully.

With ssmtp, setting up a lightweight SMTP client for your website on Ubuntu is a breeze. Its simplicity, ease of configuration, encryption support, and efficiency make it an ideal choice for tasks like website registration and notifications.

I have a video related to the topic:

Posted on 13.03.201630.05.2024 by sanglyb

Post navigation

Creating a Bootable DOS Flash Drive with Rufus: A Step-by-Step Guide →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Подписывайтесь

Youtube
vk
telegram
github
twitter
rss
  • Форум
  • Об авторе
  • Поддержать автора

Популярные записи

Новые записи

  • How to Extend an LVM Partition in Linux
  • SCCM Reporting Errors After Migrating from SQL Server 2016 to 2019
  • Problem Using PassFiltEx on Older CPUs
  • How to remove attachments from old calendar events in Exchange using a script
  • How to download and install Office 2024 LTSC

Архивы

  • 2026 (3)
  • 2025 (5)
  • 2024 (7)
  • 2023 (30)
  • 2022 (4)
  • 2020 (17)
  • 2017 (82)
  • 2016 (5)
© 2015-2026 www.mytechnote.ru
Использование материалов сайта возможно только с разрешения владельца или обязательна индексируемая, прямая, передающая вес ссылка на материал.