Difference between SMTP and SMTP relay

1

I wanted to ask you, what is the difference between SMTP and SMTP relay. And how should the latter be implemented in .net.

This is my SMTP code

 String _fromAdress = "pepe";
                String _smtpserver = "Smtp.Gmail.com";

                MailMessage mail = new MailMessage();
                SmtpClient SmtpServer = new SmtpClient(_smtpserver);
                mail.From = new MailAddress(_fromAdress);
                SmtpServer.Credentials = new System.Net.NetworkCredential("Cuenta de mail", "CLAVE");

                string from="";
                string to="";
                string subject="";
                try {

                         await Request.Content.ReadAsMultipartAsync(provider);

                    var nombre = provider.Contents[0].Headers.ContentDisposition.Name.ToString();
                    string nombrearchivo = nombre;

                    var VARfrom = provider.Contents[1].ReadAsStringAsync();
                        from = VARfrom.Result.ToString();

                        var VARto = provider.Contents[2].ReadAsStringAsync();
                        to = VARto.Result.ToString();

                        var VARasunto = provider.Contents[3].ReadAsStringAsync();
                        subject = VARasunto.Result.ToString();
                }
                catch(Exception e)
                {

                }

                mail.To.Add(to);
                mail.Subject = subject;
                mail.Body = "Cuerpo del mail";
                mail.Priority = MailPriority.Normal;
                SmtpServer.Port = Convert.ToInt32(587);
                SmtpServer.EnableSsl = true;

                    data.Name = subject;


                
                SmtpServer.Send(mail);
                return Ok();

Thank you very much already.

    
asked by Carlos 28.05.2018 в 21:11
source

1 answer

0

In simple words, the SMTP server is the one that sends the mail in your case smtp.gmail.com, an SMTP relay is an SMTP server that serves as a bridge between your SMTP client and your real SMTP server.

For example, you can have a printer (or other device) that sends emails but your firmware does not support the TLS security protocol, in which case you can configure a computer as an SMTP server within your network, if you support TLS, you can write down the parameters of your printer to this computer as your SMTP server and you configure the computer to relay the emails you receive to smtp.gmail.com so that they reach their recipient.

You can also use an SMTP relay when your SMTP client has other limitations to connect to a real SMTP server as is the authentication type; to improve the performance of an application using a SMTP relay within your network instead of the Internet, among others.

There are many SMTP servers that you can configure as SMTP relay for example Windows Server IIS or others free such as hMailServer .

Note: If your question is how to program an SMTP server to use it as mail relay I suggest you make a new publication to give consistency to the current question and answer.

    
answered by 29.05.2018 / 18:36
source