Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. SmtpMail Error

SmtpMail Error

Scheduled Pinned Locked Moved ASP.NET
helpsysadmincsharpcomquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark Sanders
    wrote on last edited by
    #1

    I am having a problem sending email using System.Web.Mail. I have provided detailed information about the issue below. Any help or comments would be greatly appreciated. ---------------------- NETWORK SETUP: ---------------------- - Web Server - A server running windows 2000 and IIS5. - Email Server - A seperate server running windows 2000 and Exchange 2000. --------------------- ERROR C# CODE: --------------------- Comments: If I enter someone@mycompanydomain.com for the testMessage.To property everything works great. I have also tried putting in the actual ip address of EXCHSRVR, but it did not change anything.

    MailMessage testMessage = new MailMessage();
    
    testMessage.To = "me@anotherdomain.com";
    testMessage.From = "me@mycompanydomain.com";
    testMessage.Subject = "Test Email";
    testMessage.Body = "Am I working???";
    
    SmtpMail.SmtpServer = "EXCHSRVR";
    SmtpMail.Send(invoiceMessage);
    

    ----------------------------- EXCEPTIONS THROWN: ----------------------------- Comments: I find it very strange that the System.Runtime.InteropServices.COMException says, "Unable to relay for me@anotherdomain.com." I would think it should say "Unable to relay for me@mycompanydomain.com." Main exception. **System.Web.HttpException** Message: Could not access 'CDO.Message' object. Error Code: -2147467259 First inner exception. **System.Reflection.TargetInvocationException** Message: Exception has been thrown by the target of an invocation. Second inner exception. **System.Runtime.InteropServices.COMException** Message: The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for me@anotherdomain.com --------------------------------------------------------- INTERNET HEADER FOR A SUCCESSFUL SEND: --------------------------------------------------------- Microsoft Mail Internet Headers Version 2.0 Received: from NS ([64.243.150.162]) by exchange.mycompanydomain.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 30 Sep 2003 10:25:20 -0500 From: me@mycompanydomain.com To: someone@mycompanydomain.com Subject: Test Email Date: Tue, 30 Sep 2003 10:25:20 -0500 Message-ID: 000101c38767$0f291e00$b80103c0@mycompanydomain.com MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer:

    M 1 Reply Last reply
    0
    • M Mark Sanders

      I am having a problem sending email using System.Web.Mail. I have provided detailed information about the issue below. Any help or comments would be greatly appreciated. ---------------------- NETWORK SETUP: ---------------------- - Web Server - A server running windows 2000 and IIS5. - Email Server - A seperate server running windows 2000 and Exchange 2000. --------------------- ERROR C# CODE: --------------------- Comments: If I enter someone@mycompanydomain.com for the testMessage.To property everything works great. I have also tried putting in the actual ip address of EXCHSRVR, but it did not change anything.

      MailMessage testMessage = new MailMessage();
      
      testMessage.To = "me@anotherdomain.com";
      testMessage.From = "me@mycompanydomain.com";
      testMessage.Subject = "Test Email";
      testMessage.Body = "Am I working???";
      
      SmtpMail.SmtpServer = "EXCHSRVR";
      SmtpMail.Send(invoiceMessage);
      

      ----------------------------- EXCEPTIONS THROWN: ----------------------------- Comments: I find it very strange that the System.Runtime.InteropServices.COMException says, "Unable to relay for me@anotherdomain.com." I would think it should say "Unable to relay for me@mycompanydomain.com." Main exception. **System.Web.HttpException** Message: Could not access 'CDO.Message' object. Error Code: -2147467259 First inner exception. **System.Reflection.TargetInvocationException** Message: Exception has been thrown by the target of an invocation. Second inner exception. **System.Runtime.InteropServices.COMException** Message: The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for me@anotherdomain.com --------------------------------------------------------- INTERNET HEADER FOR A SUCCESSFUL SEND: --------------------------------------------------------- Microsoft Mail Internet Headers Version 2.0 Received: from NS ([64.243.150.162]) by exchange.mycompanydomain.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 30 Sep 2003 10:25:20 -0500 From: me@mycompanydomain.com To: someone@mycompanydomain.com Subject: Test Email Date: Tue, 30 Sep 2003 10:25:20 -0500 Message-ID: 000101c38767$0f291e00$b80103c0@mycompanydomain.com MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer:

      M Offline
      M Offline
      Mark Sanders
      wrote on last edited by
      #2

      Problem solved. The webserver had to be setup in Exchange to be allowed to send emails out. Mark Sanders

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups