Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problem sending Email from VB.NET application

Posted on 2009-04-07
2
Medium Priority
?
332 Views
Last Modified: 2013-11-30
Hello,

This is a problem with a simple DOT NET 2 application which sends emai using system.net.mail.

It works fine here at the office on my notebook with a nuber of SMTP servers.

However at the client's site (I change the SMTP server/port to the one they need to use), the email function hangs and after a long time (Several minutes) gives a timeout error message.  In the meantime while I am waiting I cannot end the process even if I used task manager.

I can ping the mail server and get the three expected replies.

I am not sure where to begin to diagnose the problem.   It is on a large corporate network and I cannot hook my notebook into it and they are locked down so I cannot install another email client to test.

Thanks,

Stephen Simpson

Imports system.net.mail
 
Try
         Dim eMail As New MailMessage
         With eMail
 
              .From = New System.Net.Mail.MailAddress(sEmailReplyTo)
 
              Dim recipient As System.Net.Mail.MailAddress = New System.Net.Mail.MailAddress(Trim(sEmail))
              .To.Add(recipient)
 
              .Subject = "WTS for " & sLocation
              .Body = _
              "Attention: " & sContact & vbCrLf & _
              "Subject: # Edited by ModernMatt #" & vbCrLf & _
              "Location: " & sLocation & vbCrLf & _
              "Call Date: " & sCallDate & vbCrLf & vbCrLf & _
              sTextOfEmail
 
              .Attachments.Add(New Net.Mail.Attachment(di.FullName & "\" & Trim(sAttach)))
 
               .IsBodyHtml = False
          End With
 
         Dim smtpclient As New System.Net.Mail.SmtpClient
         smtpclient.Host = sSMTPServer 
         smtpclient.Port = sSMTPPort '1025
 
         If sSMTPUser <> "" Then
                smtpclient.Credentials = New System.Net.NetworkCredential(sSMTPUser, sSMTPPassword)  
         End If
 
         smtpclient.Send(eMail)
 
         eMail.Dispose()
 
Catch exEmail As Exception                    
           DisplayStatus("Email processing failed while processing:" & vbCrLf & sTrans & vbCrLf & exEmail.Message, True)
End Try

Open in new window

0
Comment
Question by:elmcomputers
[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 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1500 total points
ID: 24091435
0

Featured Post

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.

Question has a verified solution.

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

What is Usenet? There are many different opinions on exactly what Usenet is an isn't. Many opinions are incorrect simply out of ignorance. The Wikipedia listing about Usenet does a good job of explaining it, so instead of repeating it all here I wi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
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…
Suggested Courses

604 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