SMTP - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

SMTP

Description:

List of SMTP servers in transit - Check the headers on your email! ... VRFY username. Sent as a part of DATA stream. Subject: Cc: Reply-To: Data will follow. ... – PowerPoint PPT presentation

Number of Views:418
Avg rating:3.0/5.0
Slides: 11
Provided by: Ram230
Category:
Tags: smtp | username

less

Transcript and Presenter's Notes

Title: SMTP


1
SMTP
  • CS176A
  • Ramya Raghavendra
  • ramya_at_cs.ucsb.edu

2
SMTP
  • What is SMTP?
  • Simple Mail Transfer Protocol
  • SMTP server every email client interfaces to
    send email
  • List of SMTP servers in transit - Check the
    headers on your email!
  • Why talk directly to SMTP server?
  • Automation of emails in applications
  • Without dependency on another email client
  • Real time notification of status
  • Wrong ID, passwords etc

3
Example
  • Consider Windows alternative like MAPI
  • More complex
  • More overhead

4
Multipart Messages
  • But can we send multipart messages with
    attachments?
  • YES
  • SMTP is only a delivery mechanism, nothing to do
    with contents
  • RFCs on how to create multipart messages with
    attachments
  • Your assignment
  • Simple text

5
SMTP commands
6
For testing purposes
  • Part 1
  • Please note NO TURNIN
  • Part 2
  • To command line argument
  • Subject cs176aHW3ProgPart2
  • Content Name and Perm no.

7
Email Sender Logic
  • / open the network connection /
  • sfd smtpConnect(smtp_server,smtp_port)
  • if (sfd INVALID_SOCKET)
  • rc(-1)
  • goto cleanup
  • // Send HELO
  • smtpHelo(sfd,helo_domain)
  • //Send From address
  • smtpMailFrom(sfd,from)
  • //Send To address
  • smtpRcptTo(sfd)

8
Email Sender Logic (Cont)
  • //Send Data
  • smtpData(sfd)
  • //Send End-of-mail .
  • smtpEom(sfd)
  • //Send QUIT
  • smtpQuit(sfd)

9
Connection to SMTP Server
  • / connect to SMTP server and returns the socket
    fd /
  • static SOCKET smtpConnect (char smtp_server, int
    port)
  • SOCKET
  • sfd
  • sfdclientSocket(smtp_server,port)
  • if (sfd INVALID_SOCKET)
  • errorMsg("Could not connect to SMTP
    server \"s\" at port d\n",
  • smtp_server,port)
  • return (INVALID_SOCKET)
  • / save it. we'll need it to clean up /
  • smtp_socketsfd
  • return (sfd)

10
One example
  • / SMTP HELO /
  • static int smtpHelo(int sfd,char helo_domain)
  • memset(buf,0,sizeof(buf))
  • (void) snprintf(buf,sizeof(buf)-1,"HELO
    s\r\n",helo_domain)
  • //Socket write function
  • sockPuts(sfd,buf)
  • return (smtpResponse(sfd))
Write a Comment
User Comments (0)
About PowerShow.com