SMTP error on my ASP.Net page

Posted on 2006-05-09
Last Modified: 2008-01-09
Hello, I am having a problem with my SMTP server relay. I am using ASP.Net and for my server. All the functions I write that sends an email to my user give me the same error and I know the coding is currect. Does anyone have any idea whats happening?

The error I am getting is below. Thanks

The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[COMException (0x8004020f): The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
   System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
   System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +58

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
   SpeedyNotes.Register.btnSave_Click(Object sender, EventArgs e)
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1292

Question by:cwitr329
    LVL 27

    Expert Comment

    you are probably foget to authenticate against mail server before sending the message.
    LVL 2

    Expert Comment

    Check out this page for some pointers on 0x8004020f errors
    LVL 4

    Accepted Solution

    i agree with Nopius. probably you are not "logging" on the SMTP server. most SMTP servers don't allow relaying for unknown clients. you can "login" by using one of the SMTP extensions (e.g. AUTH LOGIN) or using POP before SMTP (depending on your ISP).

    quoting (it has other useful information after it as well)

    If you get "8004020E" or "80040211" errors, and you are using a remote SMTP server, make sure that you can establish a telnet session on the SMTP server from the web server, that the SMTP server is configured to allow SMTP relay, and that it doesn't require outgoing SMTP authentication. If it requires outgoing authentication, you may need to use the commercial version of ASPEmail, or another component that supports outgoing SMTP authentication. You can send e-mail to an SMTP server requiring outgoing authentication with CDO using the following code:

        NAME="CDO for Windows 2000 Library"
        Set cdoConfig = CreateObject("CDO.Configuration")  
        With cdoConfig.Fields  
            .Item(cdoSendUsingMethod) = cdoSendUsingPort  
            .Item(cdoSMTPServer) = "<enter_mail.server_here>"  
            .Item(cdoSMTPAuthenticate) = 1  
            .Item(cdoSendUsername) = "<enter_username_here>"  
            .Item(cdoSendPassword) = "<enter_password_here>"  
        End With
        Set cdoMessage = CreateObject("CDO.Message")  
        With cdoMessage
            Set .Configuration = cdoConfig
            .From = ""
            .To = ""
            .Subject = "Sample CDO Message"
            .TextBody = "This is a test for CDO.message"
        End With
        Set cdoMessage = Nothing  
        Set cdoConfig = Nothing  

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    canBalance challenge 34 58
    pairs challenge 5 33
    firstChar challenge 13 60
    python sqlite question 11 27
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    This is about my first experience with programming Arduino.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now