Solved

Help with "Mailbox unavailable." error

Posted on 2009-06-29
3
499 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
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 500 total points
ID: 24737553
0
 

Author Closing Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

914 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

23 Experts available now in Live!

Get 1:1 Help Now