?
Solved

Help with "Mailbox unavailable." error

Posted on 2009-06-29
3
Medium Priority
?
506 Views
Last Modified: 2012-05-07
Hi Experts -

I'm trying to send an email via an asp.net script and I'm getting the following error.

Mailbox unavailable. The server response was: 5.7.1 Relaying to <johnsmith@gmail.com> denied (authentication required)

Can someone please tell me what I'm doing wrong?  

PS:  My script ONLY works if I'm sending the message to someone WITHIN my domain.  Anyone on the outside my domain (i.e. HotMail, Gmail, Yahoo, etc.) will throw this error.


' Create the MailMessage instance
        Dim mail As New MailMessage()
 
        ' FROM:
        mail.From = New MailAddress("confirmation@mycompany.com", "Company Solutions")
 
        ' TO:
        mail.To.Add(strEmailAddress)
 
        ' SUBJECT & BODY
        mail.Subject = MailSubject
        mail.Body = mailText
        mail.IsBodyHtml = True
 
        ' Create the SmtpClient object
        Dim smtp As New SmtpClient
 
        '(4) Send the MailMessage (use the Web.config settings)
        smtp.Send(mail)

Open in new window

0
Comment
Question by:cdemott33
[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
3 Comments
 
LVL 4

Expert Comment

by:vbgb
ID: 24737268
It sounds like you need to provide some specific details to your mail server.

Try adding the 2 new lines shown in the attatched snippet.


 Create the MailMessage instance
        Dim mail As New MailMessage()
 
        ' FROM:
        mail.From = New MailAddress("confirmation@mycompany.com", "Company Solutions")
 
        ' TO:
        mail.To.Add(strEmailAddress)
 
        ' SUBJECT & BODY
        mail.Subject = MailSubject
        mail.Body = mailText
        mail.IsBodyHtml = True
 
        ' Create the SmtpClient object
        Dim smtp As New SmtpClient
'New lines        
 
smtp.Host = "mail.yourdomain.com'
smtp.Credentials = New Net.NetworkCredential(YourLoginName,YourPassword)
 
'to here 
        '(4) Send the MailMessage (use the Web.config settings)
        smtp.Send(mail)
 

Open in new window

0
 
LVL 14

Accepted Solution

by:
raja_ind82 earned 2000 total points
ID: 24737553
0
 

Author Closing Comment

by:cdemott33
ID: 31597956
Thanks for your help.  Those articles were helpful
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 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