SMTPRelay & .NET

Giganews Newsgroups
Subject: SMTPRelay & .NET
Posted by:  Guldil (guldilwanadoofr)
Date: Wed, 6 Dec 2006


I tried to use the SMTPRelay with .NET 1.1 & C#. I used the SMTPRelay Sample found on the Indy Project Site (In Delphi, i just try to convert it...)

Here the code i put on the Send Button :

Indy.Sockets.SMTPRelay oSmtpRelay = new Indy.Sockets.SMTPRelay();
            oSmtpRelay.OnDirectSMTPStatus +=new Indy.Sockets.TIdSMTPRelayStatus(oSmtpRelay_OnDirectSMTPStatus);
            oSmtpRelay.DNSServer = myDNSIP;

            Indy.Sockets.Message oMsg = new Indy.Sockets.Message();
            oMsg.From.Text = txtSender.Text;
            oMsg.Sender.Text = txtSender.Text;
            oMsg.Recipients.EMailAddresses = txtRecipients.Text;
            oMsg.Subject = txtSubject.Text;
            oMsg.Body.Text = txtBody.Text;

            if (oSmtpRelay.Connected())
                Msg("Unable to connect...");

When i execute this, i get an error:
EIDHostRequired on the oSmtpRelay.Connected() method...
I tried differents DNS server, always the same error.

Any idea ?