[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 767
  • Last Modified:

.net mail smtpclient fails to authenicate to AtomPark MassEmailer

I've been using .net mail for sometime now and needed to send a lot more emails so I subscribed to AtomPark Mass Emailer software.  They gave me a smtp server address, a username and password and I was ablel to setup in Outlook and it worked fine.  However in my vb.net program that I've been running for awhile when I try to send email through the AtomPark server, it fails authentication.  Again it works in outlook so I know I have the correct settings.  Anyone see anything like this where .net mail just not connecting to a 3rd party smtp server.

thanks
0
mgmhicks
Asked:
mgmhicks
  • 2
  • 2
1 Solution
 
CodeCruiserCommented:
Can you show your code?
0
 
Christopher KileCommented:
Do you have any other SMTP server to test against with your code? Because if Outlook gets it, and your code doesn't, then your code is almost certainly the problem.
0
 
mgmhicksAuthor Commented:
I am using the same code I always use to send email.  It works well with another email dll I have integrated into the program to test it out.  The system doesn't believe the username and password is correct.  Both of these are running in the same system.


Here is the partial code that doesn't work with built in .net email

Dim objMail As New MailMessage
        Dim obj As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient
        Dim myCredentials As New System.Net.NetworkCredential("shicks@gmail.com", "password")


Try
            
            obj.Host = "s02.atomsmtp.com"
            obj.UseDefaultCredentials = False
            obj.Port = "2525"
            obj.EnableSsl = False
            obj.Credentials = myCredentials
            obj.DeliveryMethod = SmtpDeliveryMethod.Network
            'obj.Send(objMail)
            SendEmail = True
            objMail.Dispose()
            mErr = "SuccessFul"
        Catch ex2 As SmtpException
            SendEmail = False
            mErr = ex2.Message
            Exit Function
        Catch ex As Exception
            SendEmail = False
            mErr = ex.Message
            Exit Function
        End Try

Open in new window


Here is the code that works with another email package.

 Dim mailman As New Chilkat.MailMan
        Dim success As Boolean
        success = mailman.UnlockComponent("Hello World")
        If (success <> True) Then
            MsgBox(mailman.LastErrorText)
            Exit Function
        End If

        ' Set the SMTP server hostname.
        mailman.SmtpHost = "s02.atomsmtp.com"
        mailman.SmtpUsername = "shicks@gmail.com"
        mailman.SmtpPassword = "password"
        mailman.SmtpPort = "2525"
        ' Create a simple email.
        Dim email As New Chilkat.Email()

        'email.Body = mystr
        email.Subject = "ChilKat Test"
        email.AddTo("Scott Hicks", "shicks@gmail.com")
        email.From = "shicks@gmail.com"
        email.SetHtmlBody(mystr)
        ' Send mail.
        success = mailman.SendEmail(email)
        If success Then
            '  MessageBox.Show("Sent mail!")
            Dim myErr1 As String
        Else
            '   MessageBox.Show(mailman.LastErrorText)
            Dim myErr2 As String = mailman.LastErrorText
            If myErr2 = "" Then
            Else

            End If
        End If

Open in new window


This first one is what I have used forever, but not with this email server.  This mail server doesn't see the credentials correctly.  In snippet #2 I use another .net vb email program and those credentials are the same and the email goes through.
0
 
Christopher KileCommented:
Your first code will only work if your target mail server is in the same network domain as your client, and I can almost guarantee that this is NOT the case when you try to connect to AtomPark.

Your second code is the code you use when you're not connecting to someone in the same network domain as yourself.  Use it in this case, with the username and password they gave you.  I never use the first case even though I only email through the corporate mail server because the corporate mail server is (deliberately) in a different network domain than anyone else to keep it secure.  I repeat, use the code where you explicitly set the username and password, and it should work.
0
 
mgmhicksAuthor Commented:
Got it and thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now