Send an email using telnet from remote servers
The below mentioned steps are used to send an email from remote servers.
+Â First thing, we will need to convert our login credentials into base64. We can convert by using the following perl scripts.
=======
$ perl -MMIME::Base64 -e ‘print encode_base64(“test\@domainname”)’
$ perl -MMIME::Base64 -e ‘print encode_base64(“password”)’
=======
Note that whereever we are using special character, we have to escape it using “\”. Note these two values, it will be used in the future.
+ Telnet to your mail server.
=======
$ telnet mail.servername.com 25
=======
+ Next, we will have to introduce ourself to the mail server by using “EHLO”.
======
EHLO
======
+ Now, the telnet prompt it ready to accept the user crendentails. Enter the following command.
=====
AUTH LOGIN
=====
The output will comes as follows.
—–
334 VXNlcm5hbWU6
—–
This is the prompt to enter username that we already converted into base64. Enter the username (in the format of base64). The next prompt you will get as follows.
—–
334 UGFzc3dvcmQ6
—–
Here, enter the password that we converted as base64. After entering, you will get a message as follows.
—-
235 Authentication succeeded
—–
Now, the final step is to send out mails withpout any email client. Enter the following commands simultaneously to send out mail from the server.
========
MAIL FROM: emailid@doamin.com
RCPT TO: dest@dest-domain.com
DATA
SUBJECT : test
test
.
========
After entering the “.”, the mail will be send from your localmachine. Please check the destination email account inbox, you should get a mail that we send now.
This is the method is used to troubleshoot mail problems from the localmachine. If any weired changes happen during these steps then you can easily identify by using this step.