?
Solved

Error while sending email using Mail.NET via smtp

Posted on 2008-06-26
4
Medium Priority
?
664 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 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article explains how to install and use the NTBackup utility that comes with Windows Server.
A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

770 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