How to send a Postfix email from a different computer in our LAN using Windows PowerShell (with authentication, with encryption)

Home > Search > How-to
  by

In the previous tutorial, we were able to send an email using port 587 on the Postfix email server itself. Let's send an email to our Postfix email server using port 587 from another computer in our LAN:

Change to the directory that contains the openssl.exe program:

cd "C:\program files\gnuwin32\bin\"

 

Start OpenSSL:

openssl.exe

 

Connect to Postfix on port 587:

OpenSSL> s_client 
-connect mail.example.com:587 
-starttls smtp 
-CAfile /etc/pki/tls/mail.example.com.pem

 

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=

 

Now we can send an encrypted email.

250 DSN
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

 

Next we can configure Mozilla Thunderbird to encrypt SMTP emails using STARTTLS and port 587.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments