Link to home
Start Free TrialLog in
Avatar of Denis Orozco
Denis OrozcoFlag for United States of America

asked on

Sending an email using SMTP throws a "Mailbox unavailable. The server response was: Too many invalid recipients" Error

Hi there,
i'm trying to send an email with the code below. The thing is that i keep getting this error "Mailbox unavailable. The server response was: Too many invalid recipients" is there something i'm missing?
I'm using VS 2008
Thanks,
COHFL
Public Shared Sub SendNotificationEmail(ByVal emailer As String, ByVal MessageSubject As String, ByVal MessageBody As String)

            'create the mail message
            Dim mail As New Net.Mail.MailMessage()

            'set the addresses
            mail.From = New Net.Mail.MailAddress("username@domain.com")'this email address does exist
            mail.To.Add("username@domain.com") 'this email does exits
            'set the content
            mail.Subject = MessageSubject & " " & Now.ToShortDateString
            mail.Body = MessageBody

            Try
                'set the server to be used
                Dim smtp As New Net.Mail.SmtpClient("mx1.server.com") 
                'send the message
                smtp.Send(mail)
            Catch ex As Exception
                Throw ex.InnerException
            End Try

        End Sub

Open in new window

Avatar of hes
hes
Flag of United States of America image

After the
 Dim smtp As New Net.Mail.SmtpClient("mx1.server.com")
Try adding in
smtp.Credentials = New System.Net.NetworkCredential("username", "password")  
Avatar of Denis Orozco

ASKER

those credential should be the sender credential right?
if the credential are the sender, still not luck. I get the same error
ASKER CERTIFIED SOLUTION
Avatar of pschrama
pschrama

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial