SMTP Authentication

I am writing a class to connect to an SMTP server over SSL and send mail. The smtp server I am using (yahoo) requires authentication. Can anyone tell me how the authentication happens, what commands should I use to send my user credentials?

Note. I am aware of the JavaMail API. I just want a simple class to send mail without external libraries.

0


a source to share


2 answers


Internet RFC 821 covers the basics of SMTP and RFC 2554 covers authentication extensions. You will need a lot of these to get a functional SMTP client.



But it is really much easier to just use JavaMail (unless this is homework, in which case I assume it would be cheating.)

+3


a source


You can do this by specifying in C #



class smtp
{
    SmtpClient client;
    MailMessage   mm;

    void send()
    {
      mm.send();
    }


    void smtp_configure()
    {
     client.Credentials = new NetworkCredential(username, password);
                client.Port = smtp_port;
                client.Host = smtp_host;              
                client.EnableSsl = true;
    }
    message_configure()
    {
      mm = new MailMessage(From, To);
      mm.Body = MgsText;
      mm.BodyEncoding = Encoding.UTF8;
      mm.Subject = Subject;
    }

   Main()
   {
      smtp_configure();
      message_configure();
      send();
    }

}

      

0


a source







All Articles