Bootstrap FreeKB - Postfix (Email) - Send email using PowerShell
Postfix (Email) - Send email using PowerShell

Updated:   |  Postfix (Email) articles

Using the same commands from previous tutorials to send an email using telnet, we now get error 454 4.7.1 <user1@example.com>: Relay access denied or 451 4.3.5 Server configuration error. This error appears because Postfix is configured to require authentication, and we did not authenticate. Notice also 2 additional status codes:

  • 250-AUTH PLAIN LOGIN
  • 250-AUTH=PLAIN LOGIN
telnet mail.example.com 25
220 mail.example.com
EHLO mail.example.com
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250=ENHANCEDSTATUSCODES
250=8BITMIME
250 DSN
mail from: root@example.com
250 2.1.0 OK
rcpt to: user1@example.com
451 4.3.5 Server configuration error

 

The client must authenticate to the Postfix server. To authenticate, we will use root's username and password. When authenticating, we will need to use root's password in Base64 encoded format. Install Perl.

[root@server1 ~]# yum install perl

 

On the Postfix server itself, use the following command to determine the Base64 version of root's password. Replace roots_password with root's actual password. The reason we use the root account and roots password is because /etc/dovecot/dovecot.conf is configured with user root. In this example, root's Base64 password is AHRlc3QAdGVzdDEyMzQ=.

[root@server ~]# perl -MMIME::Base64 -e \ 'print encode_base64("\0root\0roots_password");'
AHRlc3QAdGVzdDEyMzQ=

 

To authenticate, type AUTH LOGIN password in telnet. Replace password with root's Base64 password (AHRlc3QAdGVzdDEyMzQ=  in this example). If 235 2.0.0 Authentication successful is displayed, SASL authentication was successful. We should be able to send an email to a recipient.

telnet mail.example.com 25
220 mail.example.com
EHLO mail.example.com
220-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH PLAIN AHRlc3QAdGVzdDEyMzQ=
235 2.0.0 Authentication successful
mail from: test@example.com
250 2.1.0 OK
rcpt to: root@example.com
250 2.1.5 OK
data
354 End data with <CR><LF>.<CR><LF>
Hello World
.
250 2.0.0 Ok: queued as 567D2120523
quit
221 2.0.0 Bye

Connection to host lost

 

If the email is not showing in the list after entering the ls command, check the mail logs.

No changes are needed for Mozilla Thunderbird to use authentication. We can still send and retreive emails using Mozilla Thunderbird.

We can now create a public/private key pair to encrypt our emails.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 6fb40a in the box below so that we can be sure you are a human.