-2

What are the possible protocols for sending email in C# rather than SMTP?

POP3 and IMAP are for only receiving emails. And how I can using pop3 in c#?

user3477485
  • 123
  • 1
  • 8

1 Answers1

2

SMTP (Simple Mail Transfer Protocol) is a part of the application layer of the TCP/IP protocol. It is an Internet standard for electronic mail (email) transmission.

SMTP provides a set of protocol that simplify the communication of email messages between email servers. Most SMTP server names are written in the form "smtp.domain.com" or "mail.domain.com": for example, a Gmail account will refer to smtp.gmail.com. It is usually used with one of two other protocols, POP3 or IMAP, that let the user save messages in a server mailbox and download them periodically from the server.

This Stackoverflow question/answers will help you.

And you should also check this repo

Pop3 example:

using System; 
using Limilabs.Mail; 
using Limilabs.Client.POP3; 

class Program 
{ 
    static void Main(string[] args) 
    { 
        using (Pop3 pop3 = new Pop3()) 
        { 
            pop3.Connect("pop3.example.com");  // or ConnectSSL for SSL 
            pop3.Login("user", "password");      
            // Receive all messages and display the subject 
            MailBuilder builder = new MailBuilder(); 

            foreach (string uid in pop3.GetAll()) 
            { 
                IMail email = builder.CreateFromEml( 
                pop3.GetMessageByUID(uid)); 

                Console.WriteLine(email.Subject); 
                Console.WriteLine(email.Text); 
            } 

            pop3.Close(); 
        } 
    } 
} 
Marijke Buurlage
  • 331
  • 5
  • 21
  • Thank you for the answer. Because I've been told to program a method let the user choose the protocol he wants to choose (SMTP or POP3). But I found POP3 is just for receiving not sending. For the example of pop3, when I tried it, it asked for a reference for pop3 class? What reference you have used? – user3477485 Jan 11 '18 at 09:55
  • check here https://code.msdn.microsoft.com/windowsdesktop/emails-using-POP3-882705d3 and also i ve changed my pop3 example – Marijke Buurlage Jan 11 '18 at 12:34