Setting Postfix for outgoing mail in openSUSE

Published on April 14, 2017 by Daniel Lanza

 opensuse  postfix

A tutorial to set Postfix to send mails in openSUSE.

Requirements

You will need the following:

In this tutorial, the machine has the following:

Steps

Install Postfix

By openSUSE installation default, Postfix can be installed. If not, install it with YaST or zypper.

dalanz@mail:~> sudo zypper install postfix

Check that postfix service is running.

dalanz@mail:~> sudo service postfix status
* postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-04-14 11:02:21 CEST; 2min 27s ago
  Process: 1152 ExecStartPost=/etc/postfix/system/cond_slp register (code=exited, status=0/SUCCESS)
  Process: 1143 ExecStartPost=/etc/postfix/system/wait_qmgr 60 (code=exited, status=0/SUCCESS)
  Process: 1035 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
  Process: 1029 ExecStartPre=/etc/postfix/system/update_postmaps (code=exited, status=0/SUCCESS)
  Process: 1024 ExecStartPre=/etc/postfix/system/update_chroot (code=exited, status=0/SUCCESS)
  Process: 1017 ExecStartPre=/etc/postfix/system/config_postfix (code=exited, status=0/SUCCESS)
  Process: 1009 ExecStartPre=/bin/echo Starting mail service (Postfix) (code=exited, status=0/SUCCESS)
 Main PID: 1141 (master)
    Tasks: 3 (limit: 512)
   CGroup: /system.slice/postfix.service
           |-1141 /usr/lib/postfix/master -w
           |-1144 pickup -l -t fifo -u
           `-1145 qmgr -l -t fifo -u

Apr 14 11:02:19 mail systemd[1]: Starting Postfix Mail Transport Agent...
Apr 14 11:02:20 mail echo[1009]: Starting mail service (Postfix)
Apr 14 11:02:21 mail postfix/master[1141]: daemon started -- version 2.11.8, configuration /etc/postfix
Apr 14 11:02:21 mail systemd[1]: Started Postfix Mail Transport Agent.

Change main.cf file

With root permissions, modify /etc/postfix/main.cf file.

dalanz@mail:~> sudo vim /etc/postfix/main.cf

At the end of the file, modify or add the following parameters:

inet_interfaces = localhost, 10.0.2.15
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, $mydomain
myhostname = mail.dalanzg.com

Restart Postfix service.

dalanz@mail:~> sudo service postfix restart

Send mail with telnet

Send an email with Telnet. This is the procedure:

This is the complete process:

dalanz@mail:~> telnet mail.dalanzg.com 25
Trying 10.0.2.15...
Connected to mail.dalanzg.com.
Escape character is '^]'.
220 mail.dalanzg.com ESMTP
ehlo dalanzg.com
250-mail.dalanzg.com
250-PIPELINING
250-SIZE
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: admin@dalanzg.com
250 2.1.0 Ok
rcpt to: {email}
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject: My telnet test with Postfix

Hi,

This is an email sent by using telnet command. Mail service was set with Postfix.

Best regards,

Admin

.
250 2.0.0 Ok: queued as E57AA60775
quit
221 2.0.0 Bye
Connection closed by foreign host.

And check your inbox.

Email sent by telnet
Email sent by telnet
comments powered by Disqus

See also

Setting hostname and domain in openSUSE

A tutorial to set hostname and domain in openSUSE (server.dalanzg.com): Hostname -> srvopensuse Domain -> dalanzg.com Requirements You will need the following: An openSUSE virtual machine with VirtualBox (Check this link Steps Modify hostname file Modify hosts file Verification Modify hostname file With root permissions, edit file /etc/hostname. dalanz@linux-geij:~> sudo vim /etc/hostname Write the hostname for the server. srvopensuse Modify hosts file Check your network interfaces to find out the IP address for your Ethernet network (eth1).

Read more

Setting SSL or https in Tomcat with openSUSE

A tutorial to configure Tomcat 8 to support SSL or https connection. Requirements You will need the following: An openSUSE virtual machine with VirtualBox (Check this link Java JDK to create Keystores -> Change Java OpenJDK to Oracle JDK Tomcat -> How to install tomcat in openSUSE This tutorial was created with: openSUSE Leap 42.2 Java Version -> jdk1.8.0_121 Tomcat version -> apache-tomcat-8.0.42 Steps Create a keystore using Java JDK Set keystore in Tomcat Check SSL or https connection Create a keystore using Java JDK Keystore file is a container for authorization certificates or public key certificates.

Read more

How to install Tomcat in openSUSE

Requirements You will need the following: Tomcat 8 Optional -> (Change Java OpenJDK to Oracle JDK to run Tomcat. Steps Download Tomcat 8. This case will be Apache Tomcat 8.0.42 -> Core tar.gz (apache-tomcat-8.0.42.tar.gz). Unzip apache-tomcat-8.0.42.tar.gz file and place it in folder /usr/local/tomcat. /usr/local is a folder similar to /usr and remain safe from system software upgrades. dalanz@linux-geij:~> tar -xf apache-tomcat-8.0.42.tar.gz dalanz@linux-geij:~> sudo mkdir -p /usr/local/tomcat dalanz@linux-geij:~> sudo mv apache-tomcat-8.

Read more