Solved

.net mail smtpclient fails to authenicate to AtomPark MassEmailer

Posted on 2013-11-22
5
710 Views
Last Modified: 2013-12-12
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
Comment
Question by:mgmhicks
  • 2
  • 2
5 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39671564
Can you show your code?
0
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 39678959
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
 

Author Comment

by:mgmhicks
ID: 39712419
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
 
LVL 23

Accepted Solution

by:
Christopher Kile earned 500 total points
ID: 39715197
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
 

Author Closing Comment

by:mgmhicks
ID: 39715242
Got it and thanks
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

12 Experts available now in Live!

Get 1:1 Help Now