Postfix – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Mon, 12 Dec 2022 07:08:57 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 Postfix: Sending Emails From External SMTP Servers https://tecadmin.net/postfix-sending-emails-from-external-smtp-servers/ https://tecadmin.net/postfix-sending-emails-from-external-smtp-servers/#respond Mon, 12 Dec 2022 17:07:41 +0000 https://tecadmin.net/?p=32572 If you’re managing a Linux server, you may be wondering how to configure Postfix to send emails from external SMTP servers. Postfix is a popular open-source mail transfer agent (MTA) used to route and deliver email on Linux. While setting up Postfix to send and receive email is not difficult, using external SMTP servers can [...]

The post Postfix: Sending Emails From External SMTP Servers appeared first on TecAdmin.

]]>
If you’re managing a Linux server, you may be wondering how to configure Postfix to send emails from external SMTP servers. Postfix is a popular open-source mail transfer agent (MTA) used to route and deliver email on Linux. While setting up Postfix to send and receive email is not difficult, using external SMTP servers can be a bit more complicated.

In this article, we’ll walk you through how to configure Postfix to send emails from external SMTP servers.

What is Postfix Relayhost?

Postfix relayhost is a configuration directive that tells Postfix which external SMTP server to use when sending outbound emails. This configuration is necessary when you’re sending emails from your Linux server to external domains. Without a relayhost configured, Postfix won’t be able to send emails to external domains.

When configuring Postfix relayhost, you must specify the hostname or IP address of the remote SMTP server you want to use. This may be the hostname or IP address of the SMTP server provided by your ISP, or the hostname or IP address of a third-party SMTP service such as SendGrid, Mailgun, or Amazon SES.

Configuring Postfix to Send Email from External SMTP Servers

Before you can configure Postfix to send emails from external SMTP servers, you’ll need to install Postfix on your Linux server. If you don’t already have Postfix installed, you can install it using your Linux distribution’s package manager.

Once Postfix is installed, you can configure it to send email from external SMTP servers by editing the main Postfix configuration file, /etc/postfix/main.cf. You’ll need to add the following directive to the configuration file:

sudo postconf -e "relayhost = smtp.example.com:587" 

Replace smtp.example.com:587 with the hostname or IP address of the remote SMTP server you want to use.

Configure Authentication for Postfix Relayhost

Once you’ve added the relayhost directive to your Postfix configuration file, you’ll need to configure authentication for the remote SMTP server. This is necessary if the remote SMTP server requires authentication before it will accept and deliver emails.

To authenticate with the remote SMTP server, you’ll need to add the following directives to the Postfix configuration file:

sudo postconf -e "smtp_sasl_auth_enable = yes"
sudo postconf -e "smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_password"
sudo postconf -e "smtp_sasl_security_options = noanonymous"

You’ll also need to create a smtp_sasl_password file in the /etc/postfix directory with the following format:

[smtp.example.com]   username:password

Replace smtp.example.com with the hostname or IP address of the remote SMTP server, and replace the username and password with the authentication credentials for the remote SMTP server.

Once you’ve added the authentication credentials, you’ll need to create a smtp_sasl_password.db file by running the postmap command:

sudo postmap /etc/postfix/smtp_sasl_password  

Finally, restart the Postfix service to apply changes.

sudo systemctl restart postfix

Configuring Postfix to Use Multiple SMTP Servers

If you need to send emails from multiple SMTP servers, you can configure Postfix to use multiple relayhosts by adding multiple relayhost directives to the Postfix configuration file. For example:

relayhost = [smtp.example.com] 
relayhost = [smtp2.example.com]

You’ll also need to configure authentication credentials for each SMTP server. This can be done by adding multiple entries to the smtp_sasl_password file.

Conclusion

Configuring Postfix to send emails from external SMTP servers can be a bit complicated, but with the right configuration settings, you can easily set up Postfix to use remote SMTP servers for sending outbound emails. In this article, we’ve walked you through how to configure Postfix to send emails from external SMTP servers, as well as how to configure Postfix to use multiple SMTP servers. If you have any questions, feel free to leave a comment below.

Happy sending!

The post Postfix: Sending Emails From External SMTP Servers appeared first on TecAdmin.

]]>
https://tecadmin.net/postfix-sending-emails-from-external-smtp-servers/feed/ 0
Postfix: Configure SASL Authentication for Remote SMTP https://tecadmin.net/postfix-configure-sasl-authentication-for-remote-smtp/ https://tecadmin.net/postfix-configure-sasl-authentication-for-remote-smtp/#respond Sun, 11 Dec 2022 05:32:22 +0000 https://tecadmin.net/?p=32540 Postfix SASL Authentication is one of the most popular methods for remote SMTP authentication. It’s a secure, reliable, and highly configurable way of sending and receiving emails. Essentially, the Postfix SASL Authentication consists of an authentication server and a client. The client is a mail program that sends the message, and the authentication server validates [...]

The post Postfix: Configure SASL Authentication for Remote SMTP appeared first on TecAdmin.

]]>
Postfix SASL Authentication is one of the most popular methods for remote SMTP authentication. It’s a secure, reliable, and highly configurable way of sending and receiving emails. Essentially, the Postfix SASL Authentication consists of an authentication server and a client. The client is a mail program that sends the message, and the authentication server validates the credentials of the user. Once authentication is successful, the message is sent and authenticated at the receiving server.

The following step will configure the Postfix server to relay emails from a remote SMTP server with authentication.

  1. First of all, configure the custom relayhost parameter. This will configure postfix to relay emails via the remote SMTP servers.
    sudo postconf -e "relayhost = smtp.gmail.com:587" 
    

    You can also configure the Postfix server for d relaying emails based on the sender address.

  2. create an SMTP host and authentication mapping file:
    sudo nano /etc/postfix/smtp_sasl_password 
    

    Add your remote SMTP host and credentials one per line. See the below example:

    smtp.gmail.com           your_email@gmail.com:your_email_password
    

    Save the file and close it.

  3. Next use the postmap command to update the Postfix lookup table for the above-created configuration file.
    sudo postmap /etc/postfix/smtp_sasl_password  
    
  4. Update the Postfix main configuration file with the following commands:
    sudo postconf -e "smtp_sasl_auth_enable = yes"
    sudo postconf -e "smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_password"
    sudo postconf -e "smtp_sasl_security_options ="
    
  5. Finally, restart the Postfix service
    sudo systemctl restart postfix
    
  6. All done. You can verify the changes by sending an email via the configured remote SMTP servers.

Postfix SASL Authentication provides a secure way to transfer emails, and it’s easy to set up. It also allows you to customize the authentication process, so if you want to use things like two-factor authentication or IP whitelisting, you can. Overall, Postfix SASL Authentication is a great option for anyone who needs a secure and reliable way to transfer emails. It’s a must-have for anyone who takes security seriously!

The post Postfix: Configure SASL Authentication for Remote SMTP appeared first on TecAdmin.

]]>
https://tecadmin.net/postfix-configure-sasl-authentication-for-remote-smtp/feed/ 0
Postfix: Relay Outgoing Emails Based On Sender Address https://tecadmin.net/postfix-relay-outgoing-emails-based-on-sender-address/ https://tecadmin.net/postfix-relay-outgoing-emails-based-on-sender-address/#respond Fri, 09 Dec 2022 05:41:56 +0000 https://tecadmin.net/?p=32529 Have you ever wished you could relay outgoing emails based on the sender’s address? Well, now you can! With the help of sender_dependent_default_transport_maps, you can easily configure Postfix to route outgoing emails based on the email address of the sender. All you need to do is configure the ‘sender_dependent_default_transport_maps’ parameter in the main.cf file. This [...]

The post Postfix: Relay Outgoing Emails Based On Sender Address appeared first on TecAdmin.

]]>
Have you ever wished you could relay outgoing emails based on the sender’s address? Well, now you can! With the help of sender_dependent_default_transport_maps, you can easily configure Postfix to route outgoing emails based on the email address of the sender. All you need to do is configure the ‘sender_dependent_default_transport_maps’ parameter in the main.cf file. This is an incredibly powerful tool that can be used to easily route emails sent from different domains through different mail servers. It can also be used to route emails from different parts of your organization to different mail servers.

So if you’re looking for an easy way to relay outgoing emails based on sender address, give sender_dependent_default_transport_maps a try!

  1. First of all, create a mapping of the sender domain or email address with the corresponding SMTP server. To do this, create a configuration file as below:
    sudo nano /etc/postfix/relay_by_sender 
    

    Add the sender domain and SMTP servers one per line.

    info@example.com         	smtp:[ses.amazon.com]:587
    @example.net             	smtp:192.168.1.10:25
    no-relay@localhost		smtp
    
  2. Next use the postmap command to update the Postfix lookup table for the above-created configuration file.
    sudo postmap /etc/postfix/relay_by_sender 
    
  3. Now update the Postfix main configuration file:
    sudo postconf -e "sender_dependent_default_transport_maps = hash:/etc/postfix/relay_by_sender"
    
  4. Finally, restart the Postfix service
    sudo systemctl restart postfix
    

To verify the above settings, I have sent an email from the terminal using rahul@example.net email address. As per the above configuration, the emails from @example.net should relay through 192.168.1.10:25 SMTP server. As per the logs, the email was relayed through the correct SMTP server.

Postfix: Relay Emails Based On Sender Address
Email log

For those who need to relay outgoing emails based on the sender address, the sender_dependent_default_transport_maps parameter in Postfix can come in handy. This parameter enables you to specify which transport a message should be routed through based on its sender address.

The post Postfix: Relay Outgoing Emails Based On Sender Address appeared first on TecAdmin.

]]>
https://tecadmin.net/postfix-relay-outgoing-emails-based-on-sender-address/feed/ 0
How to Install and Configure Postfix on Ubuntu 20.04 https://tecadmin.net/how-to-install-and-configure-postfix-on-ubuntu-20-04/ https://tecadmin.net/how-to-install-and-configure-postfix-on-ubuntu-20-04/#comments Sun, 10 Oct 2021 17:11:57 +0000 https://tecadmin.net/?p=23605 Postfix is a popular Mail transfer agent(MTA) which is a part of SMTP whose full form is Simple Mail transfer protocol and Postfix’s function is to transfer/send mails from one server to another. Postfix is known because of its determination of routes and sending emails; it is completely free and installable on all major Unix [...]

The post How to Install and Configure Postfix on Ubuntu 20.04 appeared first on TecAdmin.

]]>
Postfix is a popular Mail transfer agent(MTA) which is a part of SMTP whose full form is Simple Mail transfer protocol and Postfix’s function is to transfer/send mails from one server to another. Postfix is known because of its determination of routes and sending emails; it is completely free and installable on all major Unix operating systems. Around 25% of all public servers use or run postfix on the internet.

As it is installable on all major Unix operating systems, in this article we will provide a step-by-step guide about how to install and configure Postfix on Ubuntu 20.04.

How to Install Postfix on Ubuntu

Step 1. The first step in installing Postfix is to update our system packages by typing or copying the following command in Debian 11 terminal and then pressing enter:

sudo apt update 

Step 2. Now that we have successfully updated our package index, let us continue by typing the following command in our Ubuntu Terminal which will install Postfix on Ubuntu 20.04:

sudo DEBIAN_PRIORITY=low apt install postfix 

Before going further let me explain that Debian_Priority is an environmental variable whose function is to let us configure some additional options as well with the installation of Postfix.

Step 3. When you execute the step2 command, you will be redirected to the Mail Server configurations. Read all of the configurations and navigate to the ok button using the keyboard’s left or right button.

Step 3 - Installing Postfix on Ubuntu 20.04

Step 4. After pressing ok you will be directed to the following page where you have to select the Internet Site option from the given options. By choosing the Internet Site you are configuring your Mail server. After selecting Internet Site press Enter.

Step 4 - Installing Postfix on Ubuntu 20.04

Step 5. Now you will be asked to choose System Mail Name or FQDN which stands for Fully Qualified Domain Name. I would name it tecadmin.com but you can choose whatever is suitable for you or your registered domain name. After typing your domain name, press ok.

Step 5 - Installing Postfix on Ubuntu 20.04

Step 6. After setting your mail name, you will be redirected to the Root and Postmaster Mail recipient page where you have to set your root and postmaster Mail, Recipient. You can keep the root and postmaster the same as your username. I have set mine to be tecadmin@. Navigate to ok and press enter.

Step 6 - Installing Postfix on Ubuntu 20.04

Step 7. After root and postmaster configuration, you will be redirected to the page where you have to set all the possible domains for which your mail server will be capable of accepting emails. They provide you with default values, however, you can add other domains as well. When you are done, navigate to ok and press Enter.

Step 7 - Installing Postfix on Ubuntu 20.04

Step 8. After adding the possible domains, the next step is whether you want to force synchronous updates of the mail queue or not for which the default option is no and we will also go with no by pressing enter.

Step 8 - Installing Postfix on Ubuntu 20.04

Step 9. When you press Enter, you will be directed towards the setting of the local networks which we can modify according to our needs, or go with the default one’s provided already in the input box by navigating to ok and pressing enter.

Step 9 - Installing Postfix on Ubuntu 20.04

Step 10. The next step is to limit our Mailbox size to bytes. It means to specify the size of our mailbox accepting messages and the default value is zero hence no restriction on the size of the messages. We will navigate to ok and press enter with the default value.

Step 10 - Installing Postfix on Ubuntu 20.04

Step 11. In this step, we have to select a Local Address Extension Character that has a default value with + and we will go with the default value by navigating to ok and pressing enter.

Step 9 - Installing Postfix on Ubuntu 20.04

Step 12. This is the last step in configuring postfix in which we will choose the Internet protocol that we want to or we will use. I will select all options by pressing enter.

Step 12 - Installing Postfix on Ubuntu 20.04

Step 13. After pressing Enter in the previous step, the installation of postfix will continue to completion and when the installation will be complete the following output will be seen:

Congratulations! We have successfully installed and configured Postfix on Ubuntu 20.04. We can check the status of Postfix installed with:

sudo systemctl status postfix 
Output
● postfix.service - Postfix Mail Transport Agent Loaded: loaded (/lib/systemd/system/postfix.service; enabled; vendor preset: enabled) Active: active (exited) since Sun 2021-10-10 08:59:06 UTC; 22s ago Main PID: 3438 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 1071) Memory: 0B CGroup: /system.slice/postfix.service

Conclusion

Postfix is a popular, common mail server that has an easy process of installing and configuring and is used to route and deliver email on UNIX operating systems.

In this article, we installed and configured Postfix on Ubuntu 20.04 by simplifying it as much as possible by using a stepwise sequence. If you followed this article, we are sure you must have installed and configured postfix on Ubuntu 20.04 without any errors.

The post How to Install and Configure Postfix on Ubuntu 20.04 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-and-configure-postfix-on-ubuntu-20-04/feed/ 1
Postfix Forward Incoming Emails to Other Email Account https://tecadmin.net/postfix-forward-emails-to-other-email-account/ https://tecadmin.net/postfix-forward-emails-to-other-email-account/#respond Thu, 13 Aug 2020 09:13:14 +0000 https://tecadmin.net/?p=22555 I am configuring my Linux system to accept incoming emails and forward them to needed email accounts. For this setup, the Ubuntu operating system is used with the postfix mail server. We can configure Postfix as mail forwarding server using the virtual_alias_maps settings. This tutorial will help you to set up a postfix server to [...]

The post Postfix Forward Incoming Emails to Other Email Account appeared first on TecAdmin.

]]>
I am configuring my Linux system to accept incoming emails and forward them to needed email accounts. For this setup, the Ubuntu operating system is used with the postfix mail server. We can configure Postfix as mail forwarding server using the virtual_alias_maps settings.

This tutorial will help you to set up a postfix server to forward the email to other email accounts.

Setup Mail Forwarding in Postfix

Forwarding emails to remote mailboxes via Postfix does not require local mailboxes. Any email received by the Postfix will be routed to remote mailboxes based on configuration.

Below example configuration will help you to configure example.com as mail forwarding domain on Postfix.

Edit Postfix main.cf in editor:

sudo vi /etc/postfix/main.cf 

Add your mail forwarding domain to virtual_alias_domains and a configuration file with routing rules with virtual_alias_maps. You can add multiple virtual_alias_domains with space-separated.

virtual_alias_domains = example.com tecadmin.net
virtual_alias_maps = hash:/etc/postfix/virtual

Next create and edit /etc/postfix/virtual file in editor:

sudo vi /etc/postfix/virtual 

Now add the Postfix email forwarding rules as per your requirements. Below is some example:

  1. Forward rahul@example.com emails to rahul@remote.example.com
    rahul@example.com       rahul@remote.example.com 
    
  2. Forwarding all the emails sent to any email id for domain example.com to catch-all@remote.example.com
    @example.com       catch-all@remote.example.com 
    
  3. Forward incoming emails to support@example.com to the local Unix root account.
    support@example.com       root
    

Save and close the file. Next, create a hash file of the virtual and start postfix service.

postmap /etc/postfix/virtual 
service postfix restart 

Conclusion

In this tutorial, you have learned to configured Postfix to forward emails to other email accounts.

The post Postfix Forward Incoming Emails to Other Email Account appeared first on TecAdmin.

]]>
https://tecadmin.net/postfix-forward-emails-to-other-email-account/feed/ 0
How to Install Sendmail on Ubuntu 18.04 & 16.04 LTS https://tecadmin.net/install-sendmail-on-ubuntu/ https://tecadmin.net/install-sendmail-on-ubuntu/#comments Sun, 17 Feb 2019 14:56:15 +0000 https://tecadmin.net/?p=18005 Sendmail is a general purpose email routing facility used for email transport over the Internet. It includes SMTP (Simple Mail Transfer Protocol) for the mail-transfer and email delivery. Most of the system administrators preferred to use Sendmail server as MTA than other MTAs. You can also use Sendmail server to send the email via external [...]

The post How to Install Sendmail on Ubuntu 18.04 & 16.04 LTS appeared first on TecAdmin.

]]>
Sendmail is a general purpose email routing facility used for email transport over the Internet. It includes SMTP (Simple Mail Transfer Protocol) for the mail-transfer and email delivery. Most of the system administrators preferred to use Sendmail server as MTA than other MTAs. You can also use Sendmail server to send the email via external SMTP servers like Gmail, Amazon SES, MailChimp etc.

1. Remove Postfix

Postfix is the default SMTP service pre-installed on Ubuntu operating systems. And you are willing to use Sendmail server on your system.

First of all, remove the existing postfix installation on Ubuntu.

sudo systemctl stop postfix
sudo apt remove postfix && apt purge postfix

2. Install Sendmail

If you don’t have installed Sendmail using the following command to install Sendmail with other required packages using yum package manager.

sudo apt install sendmail

3. Configure Sendmail Server

The execute the sendmailconfig command to complete the basic configuration.

sudo sendmailconfig

Select all options to ‘Y’ and press enter. Wait for the command finish.

Your server is ready for sending emails. You can use the Linux command line or PHP script to send emails.

4. Receive Incomming Emails

Edit /etc/mail/sendmail.mc file and comment below line to allow receiving an email from anywhere. To comment a line in sendmail.mc, just put dnl keyword at the start of the line.

dnl DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl
dnl DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, M=Ea, Addr=127.0.0.1')dnl

Then add your domain names to /etc/mail/local-host-names file.

cat /etc/mail/local-host-names

tecadmin.net
mail.tecadmin.net
localhost
localhost.localdomain

Now use m4 is a macro processor to compile the Sendmail configuration files. m4 is stream-based, that is, it doesn’t understand about lines.

sudo m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Restart Sendmail service

sudo systemctl restart sendmail

Your system is ready for incoming emails.

5. Configure Domain-based E-mail Routing

As we read above that virtusertable file used for aliasing, allowing multiple virtual domains to be hosted on one machine.

  • 1. All emails addressed to @example.com domain delivered to support@mydomain.com
    @example.com support@mydomain.com
    
  • 2. All emails addressed to support@mydomain.com will forward to local user jack.
    support@mydomain.com  jack
    
  • 3. All emails addressed to @mydomain.com will forward to domain @otherdomain.com with corresponding usernames.
    @mydomain.com    %1@otherdomain.com
    
  • 4. All emails addressed to @otherdomain.com will be rejected my mail server with acknowledging sender with the message
    @otherdomain.com 	 error:nouser User unknown
    

After making all changes in virtusertable execute following command to create updated virtusertable.db file containing the new configuration.

sudo makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable

Now restart Sendmail service

sudo /etc/init.d/sendmail restart

Thanks for reading this article. I hope this article will help you to configure Sendmail on Ubuntu Linux systems.

References:
http://www.sendmail.com/
http://www.sendmail.com/sm/open_source/docs/m4/intro_m4.html

The post How to Install Sendmail on Ubuntu 18.04 & 16.04 LTS appeared first on TecAdmin.

]]>
https://tecadmin.net/install-sendmail-on-ubuntu/feed/ 8
How to Setup Mail Forwarding in Postfix https://tecadmin.net/setup-mail-forwarding-in-postfix-on-linux/ https://tecadmin.net/setup-mail-forwarding-in-postfix-on-linux/#comments Tue, 05 Jan 2016 05:56:31 +0000 https://tecadmin.net/?p=9547 Postfix is widely used Mail Transfer Agent (MTA) server, which provides to send, receive and forward emails over network. This tutorial will help you to configure your Postfix server to forward emails. Install Postfix MTA We are assuming that you already have postfix installed and configured on your system. Or you can use following commands [...]

The post How to Setup Mail Forwarding in Postfix appeared first on TecAdmin.

]]>
Postfix is widely used Mail Transfer Agent (MTA) server, which provides to send, receive and forward emails over network. This tutorial will help you to configure your Postfix server to forward emails.

Install Postfix MTA

We are assuming that you already have postfix installed and configured on your system. Or you can use following commands to install Postfix on Linux box according to your operating system.

On Debian Based Systems

$ sudo apt-get update
$ sudo apt-get install postfix

On RHEL Based Systems

# yum install postfix

On OpenSUSE Systems

# zypper in postfix

After installation make sure Postfix is running on your system. Default postfix used standard port 25. Use the following commands to check that your system is listening on port 25 or not.

# netstat -tulpn | grep 25

tcp    0   0 0.0.0.0:25    0.0.0.0:*         LISTEN      4398/master
tcp6   0   0 :::25         :::*              LISTEN      4398/master

Configure Email Forwarding in Postfix

Let’s start with email forwarding configuration in Postfix configuration file (/etc/postfix/main.cf). Edit this file and add/edit the following configurations. Change example.com and example.net domain names with your domain name

virtual_alias_domains = example.com example.net
virtual_alias_maps = hash:/etc/postfix/virtual

After making any changes in configuration files make sure to restart Postfix service.

Email Forwarding Examples

/etc/postfix/virtual is the file where we will add email forwarding rules. Let’s starts begin with the email forwarding rules.

1 – Forward all emails sent to info@example.com and info@example.net to rahul@myemail.com.

info@example.com rahul@myemail.com
info@example.net rahul@myemail.com

2 – Forward support@example.com emails to rahul@myemail.com and admin@myemail.com

support@example.com rahul@myemail.com admin@myemail.com

3 – Forward any email sent to @example.com domain to rahul@myemail.com. Also forward any email sent to @example.net domain to rahul@myemail.com as well as admin@myemail.com

@example.com rahul@myemail.com
@example.net rahul@myemail.com admin@myemail.com

Verify Setup

Let’s verify all settings by sending emails to @example.com and @example.net domain email accounts.

The post How to Setup Mail Forwarding in Postfix appeared first on TecAdmin.

]]>
https://tecadmin.net/setup-mail-forwarding-in-postfix-on-linux/feed/ 3
How To Install Postfix on Ubuntu 18.04 & 16.04 LTS https://tecadmin.net/install-postfix-on-ubuntu/ https://tecadmin.net/install-postfix-on-ubuntu/#comments Thu, 23 Apr 2015 16:26:57 +0000 https://tecadmin.net/?p=6086 Postfix is fast and popular SMTP server widely used. The main job of Postfix is to relay mail locally or to an intended destination outside the network. Some of the most popular SMTP servers are Sendmail, Postfix, and Qmail. This article will help you to install Postfix on Ubuntu 18.10, 18.04 LTS, 16.04 LTS, and [...]

The post How To Install Postfix on Ubuntu 18.04 & 16.04 LTS appeared first on TecAdmin.

]]>
Postfix is fast and popular SMTP server widely used. The main job of Postfix is to relay mail locally or to an intended destination outside the network. Some of the most popular SMTP servers are Sendmail, Postfix, and Qmail. This article will help you to install Postfix on Ubuntu 18.10, 18.04 LTS, 16.04 LTS, and 14.04 LTS systems.

For this tutorial, we are using the FQDN as mail.tecadmin.net for configuring this host.

Step 1 – Install Postfix

Postfix packages are available under default repositories of Ubuntu operating systems. Simply use the following command to install Postfix SMTP server on your Ubuntu system.

sudo apt-get install postfix

The installation process will ask you for some inputs like below. Just

Install Postfix on Ubuntu

Install Postfix on Ubuntu

Step 2 – Configure Postfix

Let’s start Postfix configuration. Edit Postfix configuration file /etc/postfix/main.cf in your favourite editor and make following changes. Change myhostname, mydomain as per your requirements.

  myhostname = host.tecadmin.net
  mydomain = tecadmin.net
  myorigin = $mydomain
  mydestination = $myhostname, localhost, $mydomain, localhost.localdomain
  mynetworks = 127.0.0.0/8, /32
  relay_domains = $mydestination
  inet_interfaces = all
  inet_protocols = all
  home_mailbox = Maildir/

Step 3 – Restart Postfix Service

As we have done basic Postfix configuration, So restart Postfix service to read changes of configuration. Also, configure to autostart on system boot.

sudo service postfix restart

The post How To Install Postfix on Ubuntu 18.04 & 16.04 LTS appeared first on TecAdmin.

]]>
https://tecadmin.net/install-postfix-on-ubuntu/feed/ 3
How to flush Postfix Mail Queue https://tecadmin.net/flush-postfix-mail-queue/ https://tecadmin.net/flush-postfix-mail-queue/#comments Fri, 27 Feb 2015 07:19:05 +0000 https://tecadmin.net/?p=6356 Questions:- How do I flush Postfix mail queue? How to remove emails from mail queue in Postfix? Postfix flush mail queue? Postfix remove differed emails from the queue? Postfix empty the mail queue command line? This article will help you for flush or clear or delete emails from Postfix mail queue. This will also help [...]

The post How to flush Postfix Mail Queue appeared first on TecAdmin.

]]>
Questions:- How do I flush Postfix mail queue? How to remove emails from mail queue in Postfix? Postfix flush mail queue? Postfix remove differed emails from the queue? Postfix empty the mail queue command line?

This article will help you for flush or clear or delete emails from Postfix mail queue. This will also help you to delete emails from single mail queue or any specific email.

List All Emails

To list all mail of queue, use one of the following commands.

postqueue -p

Flush All Emails

To delete or flush all emails from Postfix mail queue using the following command.

postsuper -d ALL

Flush Deferred Mails Only

You can only delete all deferred emails only from the mail queue. Use the following command to delete deferred emails from the queue.

postsuper -d ALL deferred

Remove Specific Email

If you want to remove any specific email. Use the following command to remove specific emails only. First search the ID of that email like below command

postqueue -p | grep "email@example.com"

056CB129FF0*    5513 Sun Feb 26 02:26:27  email@example.com

Now delete the mail from mail queue with id 056CB129FF0.

postsuper -d 056CB129FF0

The post How to flush Postfix Mail Queue appeared first on TecAdmin.

]]>
https://tecadmin.net/flush-postfix-mail-queue/feed/ 7
How to Setup Catch-All Email Account in Postfix https://tecadmin.net/setup-catch-all-email-account-in-postfix/ https://tecadmin.net/setup-catch-all-email-account-in-postfix/#comments Sat, 12 Jul 2014 11:00:21 +0000 https://tecadmin.net/?p=1793 Catch-All email account is used to collect all emails sent to any email of a domain. It helps us to avoid losing emails due to misspelled addresses. While using the catch-all address you may receive spam messages and many other bounce messages that sent to any-email (at) your-domain.com. This tutorial will help you to set [...]

The post How to Setup Catch-All Email Account in Postfix appeared first on TecAdmin.

]]>
Catch-All email account is used to collect all emails sent to any email of a domain. It helps us to avoid losing emails due to misspelled addresses. While using the catch-all address you may receive spam messages and many other bounce messages that sent to any-email (at) your-domain.com.

This tutorial will help you to set up a catch-all email address with a postfix server.

Step 1 – Setup Catch-All Account

A catch-all account can be created by adding a virtual aliases to the postfix server. To add an alias edit /etc/postfix/virtual configuration file:

nano /etc/postfix/virtual

Then add a catch-all address like below:

@example.com myuser

You may also have some actual email accounts on your domain and you need to forward emails of that accounts to the correct mailbox. Then you can also create virtual alias for that email address and forward it to specific user’s mailboxes. Use the below configuration, which will send all emails to user “myuser” except emails of info@example.com and support@example.com.

@example.com myuser
info@example.com  info
support@example.com support

Save and close configuration file, then execute the following command to create or update hash file.

postmap /etc/postfix/virtual

The above command will create /etc/postfix/virtual.db file in your system. Which will be used by the Postfix server.

Step 2 – Update Postfix Configuration File

Now, you need to add virtual_alias_maps to the Postfix main configuration file. Just edit Postfix configuration file /etc/postfix/main.cf in your favorite text editor:

nano /etc/postfix/main.cf

Add the following entry to the end of the file

virtual_alias_maps = hash:/etc/postfix/virtual

Save the file and close it.

Step 3 – Reload Postfix Server

After making all the changes, reload the postfix service to apply all settings. Use the following command to reload the postfix configuration.

systemctl reload postfix

You have completed postfix catch-all email setting configuration. Click here to read more about catch all account.

The post How to Setup Catch-All Email Account in Postfix appeared first on TecAdmin.

]]>
https://tecadmin.net/setup-catch-all-email-account-in-postfix/feed/ 11