Results 1 to 9 of 9

Thread: SMTP Hanging during execution

  1. #1

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627

    SMTP Hanging during execution

    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.

  2. #2

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627
    Just the SMTP component built into VB. Is that what you mean?

  3. #3
    Addicted Member Halon's Avatar
    Join Date
    Oct 2002
    Location
    under desk choking on rage
    Posts
    228
    Don't know if this would help but i find throwing in a DoEvents will allow anything trying to execute within the system to go forward. Has helped a few of my apps from freezing up
    Soylent Green tastes like chicken

  4. #4

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627
    Good point. I'll toss one in there.

  5. #5

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627
    I didn't know it was in there for a long time either. Usually because I'm looking at "Microsoft yadayada control". It's in the components, just called SMTPControl. Very handy and relatively simple.

  6. #6
    Banned Kyle_Katarn's Avatar
    Join Date
    Jul 2002
    Location
    Toulouse, France
    Posts
    89
    K-mail does it better

  7. #7

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627
    Well, it looked like the doevents was making a difference, then it hung up again on a test run. Anyone have any other ideas?

    This needs to run with no user intervention, it will run at 2am everyday, so Kmail is not an option.
    Last edited by demotivater; Oct 31st, 2002 at 10:49 AM.

  8. #8
    Banned Kyle_Katarn's Avatar
    Join Date
    Jul 2002
    Location
    Toulouse, France
    Posts
    89
    K-mail do not require any kind of intervention so it might be a good solution to your problem ...

  9. #9

    Thread Starter
    Fanatic Member demotivater's Avatar
    Join Date
    Jun 2002
    Location
    is everything
    Posts
    627
    Anyone else?
    Buehler, Buehler??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width