Solved

Error while sending email using Mail.NET via smtp

Posted on 2008-06-26
4
662 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 21876883
0
 
LVL 4

Accepted Solution

by:
antioed earned 250 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In this video we show how to create an Address List 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 Organization >> Ad…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

696 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