Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sending email with

Posted on 2010-09-22
6
Medium Priority
?
386 Views
Last Modified: 2012-05-10
Hi Experts,

I have incorporated this function that sends an email via System.Net.Mail.SmtpClient. It works fine on 5 of 6 computers, however it generates an error that complains about EHLO parameters, on the sixth. It feels like I have tried everything.

Any ideas? Se code.

Regards
Per

Dim pMailMessage As New MailMessage
        
With pMailMessage
  .From = New MailAddress(txtAnswerEmail.Text)

  'able to handle more then a single recipient 
  strAddresses = txtTo.Text.Replace(",", ";")
  For Each strX As String In strAddresses.Split(";"c)
    If strX.Trim.Length > 0 Then
      .To.Add(New MailAddress(strX))
    End If
  Next

  .Subject = txtSubject.Text
  .Body = "My company " & txtFrom.Text & " " & vbCrLf
  .Body &= "Org.nr " & txtOrgNr.Text & " " & vbCrLf
  .Body &= "Kontakt " & txtContact.Text & " " & vbCrLf
  .Body &= "E-post " & txtAnswerEmail.Text & " " & vbCrLf
  .Body &= "Adress " & txtAddress.Text & " " & vbCrLf
  .Body &= "Postnr " & txtZipCode.Text & " " & vbCrLf
  .Body &= "Ort " & txtCity.Text & " " & vbCrLf
  .Body &= "Telefon " & txtTelephone.Text & " " & vbCrLf
         
  .IsBodyHtml = False

End With
   
Dim objSMTPClient As New SmtpClient()
objSMTPClient.Host = "mail.mydomain.com" '
objSMTPClient.Port = 587
objSMTPClient.Credentials = New System.Net.NetworkCredential("order@mydomain.com", "pw")

objSMTPClient.Send(pMailMessage)

Open in new window

0
Comment
Question by:PerryDaynac
[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
  • 2
6 Comments
 
LVL 7

Expert Comment

by:Chrissalter
ID: 33733283
Check the local firewall on the 6th machine

587 is a non standard port and probably wont be open

alternatively

add a try / catch around lines 28 - 34

use smtpexception instead of just exception and you will be able to catch the exact status code
 
0
 
LVL 7

Accepted Solution

by:
Chrissalter earned 2000 total points
ID: 33733293
also look into the computername of that 6th machine

the ehlo command usually sends

EHLO <computername>

there may be something in the computername that is freaking the smtp server out
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 33733519
have you tried port 465?
have you tried to turn off your firewall for the test?
0
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.

 

Author Comment

by:PerryDaynac
ID: 33734243
Ok, great. It was the computer name, that was the problem.

However, I don't want our customers to manually change the computer name if the program fails.
Is there a way to allow special characters? (like to UTF-8)
In my case it was a special swedish character that made the error...


0
 
LVL 7

Expert Comment

by:Chrissalter
ID: 33734344
i do not believe you can change the ehlo command when using net.mail

its an outdated but standard feature

the only real alternative is to write the raw message and send it via telnet

its not as difficult as it seems as the commands are well documented
0
 

Author Closing Comment

by:PerryDaynac
ID: 33734537
Thank you!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

721 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