ABHIONLINUX
Site useful for linux administration and web hosting

2010/05/12

Send/Recieve email using Telnet


Send mail through SMTP using Telnet

Telnet to the server via port 25.

1. Type “EHLO example.com” and hit enter.

2.  “MAIL FROM: sender@domain.com” and hit enter.

3.  “RCPT TO: recipient@domain.com” and hit enter.

4.  “DATA” and hit enter.

5. Type your message body and hit enter.

6. Key in ” . ” and press enter to exit.

You will recieve the mail.


==============================================
Example:

root@test.com]# telnet 192.168.0.25 25
Trying 192.168.0.25...
Connected to 192.168.0.25 (192.168.0.25).
Escape character is '^]'.
220 test.tt.example.com ESMTP MAIL Service, Version: 5.0.2195.6713 ready at Thu, 3 Apr 2008 15:39:17 +0800
EHLO Vsource.com
250-smtp11.klk.example.com Hello [192.168.0.192]
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-TURN
250-ATRN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250 OK
MAIL FROM: abhi@example.com
250 2.1.0 abhi@example.com....Sender OK
RCPT TO: abhi_tt@example.com
250 2.1.5 abhi_tt@example.com
DATA
354 Start mail input; end with .
this is a test over SMTP
.
250 2.6.0 Queued mail for delivery
quit
221 2.0.0 smtp11.klk.example.com Service closing transmission channel
Connection closed by foreign host.
[root@test.com]#

2010/04/21

How to set multiple IP addresses using Linux command line

Go to /etc/sysconfig/network-scripts
Make multiple copies of ifcfg-eth0 and name them as ifcfg-eth0:0, ifcfg-eth0:1 etc.
Open each of them and at least change the IPADDR to your chosen IP address and the NETMASK to the subnet mask for that IP address.
A sample entry would look like this:

DEVICE=eth0:0
BOOTPROTO=static
IPADDR=34.123.111.21
NETMASK=255.255.255.0
ONBOOT=yes

Restart the network:
/sbin/service network restart
/etc/init.d/ipaliases restart (for cpanel servers) 

If you have more than 100's of IP, it is difficult to choose above method. For that  you can try the following method.

[root@server ~]#d /etc/sysconfig/network-scripts/ – this is where the network settings are being searched for
[root@server network-scripts]# vi ifcfg-eth0-range0 – this will be the file where we define the new IP class(considering that our main interface is called eth0)
Add this content to the file:

IPADDR_START=192.168.0.1
IPADDR_END=
192.168.0..28
CLONENUM_START=1
NETMASK=255.255.255.240


Explanation:
IPADDR_START – the first IP of the class you want to add
IPADDR_END – last IP of the class you want to add
CLONENUM_START – the number with which the virtual interface will start, this will create the virtual interfaces eth0:1 to eth0:28.
If you have more classes that you want to add on the next class CLONENUM will start at 29.
NETMASK – the mask for the IP class
After all this was added to the file and edited accordingly just save and restart the network.

.