SlideServe
Menu
Préférences
© SlideServe · v2026

SMTP

dante avatar
10 diapositives · 624 Views · Sep 25, 2012

SMTP. CS176A Ramya Raghavendra ramya@cs.ucsb.edu. 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?

SMTP - slide 1
01 / 10SMTP
1 / 17

Télécharger la présentation

SMTP
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. SMTP CS176A Ramya Raghavendra ramya@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. Consider Windows alternative like MAPI More complex More overhead Example

  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; sfd=clientSocket(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_socket=sfd; 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)); }