1 / 30

Network Programming

Network Programming. 10- SMTP-POP3. Hariandi Maulid, S.T., M.Sc – Informatics Engineering- School of Applied Science,Telkom University. The SMtp.

tdaniel
Download Presentation

Network Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Network Programming 10- SMTP-POP3 Hariandi Maulid, S.T., M.Sc – Informatics Engineering- School of Applied Science,Telkom University

  2. The SMtp • Short for Simple Mail TransferProtocol,a protocolfor sending e-mailmessages between servers. Most e-mail systems that send mail over the Internet use SMTP to send messages from one server to another; the messages can then be retrieved with an e-mail clientusing either POP or IMAP. • In addition, SMTP is generally used to send messages from a mail client to a mail server. This is why you need to specify both the POP or IMAP server and the SMTP server when you configure your e-mail application. • SMTP by default uses TCP port25. The protocol for mail submission is the same, but uses port 587. SMTP connections secured by SSL,known as SMTPS, default to port 465 (nonstandard, but sometimes used for legacy reasons).

  3. SMtp transport example • A typical example of sending a message via SMTP to two mailboxes (alice and theboss) located in the same mail domainexample.com or localhost.com) is reproduced in the following session exchange. (In this example, the conversation parts are prefixed with S:Server andC:Client) • After the message sender (SMTP client) establishes a reliable communications channel to the message receiver (SMTP server), the session is opened with a greeting by the server, usually containing its Fully Qualified Domain Name (FQDN), in this case smtp.example.com.The client initiates its dialog by responding with a HELLO command identifying itself in the command’s parameter with its FQDN.

  4. SMTP Reply Codes

  5. The mail server installation • Download the mail server from www.hmailserver.com/download • Afer successfull installation: • 1. Create a domain ex: netpro.com • 2. Create 2 (two) users : user1@netpro.com and user2@netpro.com

  6. Creating a domain Creating 2 users

  7. Installing email client • Download Mozilla Thunderbird from https://www.mozilla.org/en-US/thunderbird/ • After Successfull installation: • Create new account Email: • user1@netpro.com • user2@netpro.com

  8. Now you can send (write) and receive (read) message between user1 and user 2

  9. Sending email with java socket • In the previous step, we have installed hmail server in our localhost(127.0.0.1). This mail server can be used as a target host/server for our java socket program to send email. • Here is the code for connecting to the server. • Sttring host: “127.0.0.1” • int port =25; • Socket socket= new Socket (host, port); • The complete code can be obtained in the next page

  10. The sending mail code

  11. The result

  12. Check The result in thunderbird

  13. Imap and pop3 • IMAP • IMAP stands for Internet Message Access Protocol. IMAP shares many similar features with POP3. It, too, is a protocol that an email client can use to download email from an email server. However, IMAP includes many more features than POP3. The IMAP protocol is designed to let users keep their email on the server. IMAP requires more disk space on the server and more CPU resources than POP3, as all emails are stored on the server. IMAP normally uses port 143.

  14. Imap and pop3 (2) • POP3 • POP3 stands for Post Office Protocol. POP3 allows an email client to download an email from an email server. The POP3 protocol is simple and does not offer many features except for download. Its design assumes that the email client downloads all available email from the server, deletes them from the server and then disconnects. POP3 normally uses port 110.

  15. IMAP vs POP3 • POP3 and IMAP are two different protocols (methods) used to access email. • Of the two, IMAP is the better option - and the recommended option - when you need to check your emails from multiple devices, such as a work laptop, a home computer, or a tablet, smartphone, or other mobile device. Tap into your synced (updated) account from any device with IMAP. • POP3 downloads email from a server to a single computer, then deletes it from the server. Because your messages get downloaded to a single computer or device and then deleted from the server, it can appear that mail is missing or disappearing from your Inbox if you try to check your mail from a different computer.

  16. IMAP vs POP3 (2)

  17. POP3 with Java • String host= “127.0.0.1”; • int port= 110; • Socket socket= new Socket (host, port); • Send User • wr.write (“USER user1@netpro.com \r\n”); • Send Password • wr.write (“PASS user1 \r\n”);

  18. The message to be retrieved

  19. The pop3 code

  20. The result

More Related