I've used the following email code quite a bit, usually with no problems. The latest program parses a file, and sends the results via email. Problem is, every few runs, the program hangs during the email routine. I believe it gets stuck at the .sendEmail line. No errors, doesn't crash, just hangs up. Usually takes about 20 seconds to attach the file and send the email, I've let it go a few times that it hung up and it stayed stuck for over 5 minutes before I killed it. Am I missing something in this code? As I said, I use this routine alot, just not with a file this large, sometimes it works, sometimes it sticks. grrrr

VB Code:
  1. 'send the email
  2.     With SMTP
  3.         .Server = "serverIPaddress"
  4.         .Username = ""
  5.         .Password = ""
  6.         .MailFrom = "fromName"
  7.         .SendTo = "toName" 'bill
  8.         .CC = "ccName" 'chris
  9.         .BCC = "bccName" 'me
  10.         .MessageSubject = strSubject
  11.         .MessageText = strBody
  12.         .Attachments.Add (mailFile)
  13.         lblMain.Caption = lblMain.Caption & " Sending email..." & vbCrLf
  14.         Me.Refresh
  15.         .sendEmail
  16.         .Attachments.Remove (1) 'remove attachment so it doesnt mail again on second pass through
  17.     End With

Thanks in advance.