Solved

Problem sending Email from VB.NET application

Posted on 2009-04-07
2
302 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
2 Comments
 
LVL 70

Accepted Solution

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

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

772 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