Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help with "Mailbox unavailable." error

Posted on 2009-06-29
3
Medium Priority
?
510 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:Geoff Bryan
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

610 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