?
Solved

Error while sending email using Mail.NET via smtp

Posted on 2008-06-26
4
Medium Priority
?
670 Views
Last Modified: 2013-11-30
I get the following message while trying to instantiate and send an email.  I've hidden the actual pwd/user/domain for obvious reasons but have verified with the admin that they are accurate.  I'm using my own local domain email address and trying to test sending to hotmail/yahoo account. Any suggestions would be appreciated.

"mailbox unavailable. The server response was 5.7.1 unable to relay for" the hotmail email address I;m testing


public Email()
    {
        SmtpClient smtpClient = new SmtpClient(smtpAdd);
        MailMessage message = new MailMessage(messageFrom, messageTo, subject, body);
        //smtpClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
        smtpClient.UseDefaultCredentials = false;
        NetworkCredential credential = new NetworkCredential(username,password,domain);
        //smtpClient.Credentials = credential;
        //smtpClient.Credentials = CredentialCache.DefaultNetworkCredentials;
        
        smtpClient.Send(message);
    }

Open in new window

0
Comment
Question by:abedeenf
4 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 21876883
0
 
LVL 4

Accepted Solution

by:
antioed earned 750 total points
ID: 21877304
Either your credentials are not authenticating Exchange properly or you are instantiating from a remote host that is not permitted "relay".  I am guessing the former since I have run into this before.  Not sure about the exact programmatic Mail.Net syntax required but it might just be that you need to format the credentials so they are passed  in <domain>\<user> format.
0
 

Expert Comment

by:Sha_Sha_In
ID: 21878240
Hi,

If you are stillfacing problem, follow these steps one by one, your problem will be resolved,

1.      Open IIS (Start-> Run -> Type inetmgr -> Click OK)
    1.1.      Web_Server_Machine_Name -> Default SMTP Virtual Server -> Properties
    1.2.      Select Security Tab -> In Operators section, Administrators should exist, otherwise Add Administrators group.
    1.3.      Select Access Tab -> Click on Relay -> Select only the list below option -> If 127.0.0.1 does not exists, follow these steps,
            1.3.1.      Click on Add -> Select Single Computer
            1.3.2.      Type 127.0.0.1 in IP address
            1.3.3.      Click on OK -> Click on OK
    1.4.      Select Access Tab -> Click on Authentication
            1.4.1.      Uncheck Anonymous access
            1.4.2.      Check Integrated Windows Authentication
            1.4.3.      Click on OK
    1.5.      Select Delivery Tab -> Click on Advanced -> Provide following values in fields,
            1.5.1.      Maximum hop count - 15
            1.5.2.      Full-qualified domain name - Web_Server_Machine_Name.domain.local (Whatever it is...)
            1.5.3.      Smart host - SMTP_Server_Machine_Name.domain.local (Whatever it is...)
            1.5.4.      Check Attempt direct delivery before sending to smart host checkbox
            1.5.5.      Uncheck Perform reverse DNS lookup on incoming messages checkbox
            1.5.6.      Click on OK  -> Click on Apply -> Click on OK
2.      Restart IIS (Start-> Run -> Type iisreset -> Click OK)
3.      Give write access permissions on "C:\Inetpub\mailroot" folder to the appropriate user depending on operating system type,
            For Windows XP/2000 Permissions - Web_Server_Machine_Name\ASPNET
            For Windows 2003 Server Permissions - NETWORK Service

Regards,
Sha_Sha_In
0
 

Author Closing Comment

by:abedeenf
ID: 31471052
Thanks for pointing me in the right direction!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
Here in this article, you will get a step by step guidance on how to restore an Exchange database to a recovery database. Get a brief on Recovery Database and how it can be used to restore Exchange database in this section!
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

755 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