Solved

.net mail smtpclient fails to authenicate to AtomPark MassEmailer

Posted on 2013-11-22
5
748 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
[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
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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