|
-
Oct 30th, 2002, 04:18 PM
#1
Thread Starter
Fanatic Member
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:
'send the email
With SMTP
.Server = "serverIPaddress"
.Username = ""
.Password = ""
.MailFrom = "fromName"
.SendTo = "toName" 'bill
.CC = "ccName" 'chris
.BCC = "bccName" 'me
.MessageSubject = strSubject
.MessageText = strBody
.Attachments.Add (mailFile)
lblMain.Caption = lblMain.Caption & " Sending email..." & vbCrLf
Me.Refresh
.sendEmail
.Attachments.Remove (1) 'remove attachment so it doesnt mail again on second pass through
End With
Thanks in advance.
-
Oct 30th, 2002, 04:42 PM
#2
Thread Starter
Fanatic Member
Just the SMTP component built into VB. Is that what you mean?
-
Oct 30th, 2002, 04:47 PM
#3
Addicted Member
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
-
Oct 30th, 2002, 04:50 PM
#4
Thread Starter
Fanatic Member
Good point. I'll toss one in there.
-
Oct 30th, 2002, 04:59 PM
#5
Thread Starter
Fanatic Member
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.
-
Oct 31st, 2002, 09:11 AM
#6
Banned
-
Oct 31st, 2002, 09:29 AM
#7
Thread Starter
Fanatic Member
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.
-
Oct 31st, 2002, 09:38 AM
#8
Banned
K-mail do not require any kind of intervention so it might be a good solution to your problem ...
-
Oct 31st, 2002, 11:50 AM
#9
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|