1

The project I am working on need to send mail to Zimbra as well as Gmail IDs.

The mail server used here is Zimbra Client Server and Port used is 25.

But while sending mail to Gmail ID,Exception occurs as follows.

Exception : Transaction failed. The server response was: 5.7.1 somegmail_Id@gmail.com: Relay access denied

Code section

            int port = 25;
            oSmtpClient.UseDefaultCredentials = false;
            oSmtpClient.Credentials = new NetworkCredential(sUserName, sPassword);
            oSmtpClient.Host = sServer;
            oSmtpClient.Port = port;
            oSmtpClient.EnableSsl = true;
            oSmtpClient.UseDefaultCredentials = false;
            MailMessage oMailMessage = new MailMessage(); ;
            oMailMessage.From = new MailAddress(sFrom);
            oMailMessage.To.Add(new MailAddress(MailId));
            oMailMessage.Subject = "Subject";
            oMailMessage.Body = sBody;
            oMailMessage.IsBodyHtml = true;
            oSmtpClient.Send(oMailMessage);
Ne2
  • 35
  • 7

0 Answers0