Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Communications > Email takes too long to send

Thread Tools Display Modes
Old 09-17-2003, 01:48 PM
dgdolins1 dgdolins1 is offline
Join Date: Dec 2002
Posts: 124
Default Email takes too long to send


I'm using the following code to send an Email

Public Function SendEmail(eTo As String, eSubject As String, eBody As String) Dim objOutlook As Object Dim objOutlookMsg As Object Set objOutlook = CreateObject("Outlook.Application") Set objOutlookMsg = objOutlook.CreateItem(0) With objOutlookMsg .To = eTo .Subject = eSubject .Body = "This is the body of message" .HTMLBody = eBody .Send End With Set objOutlookMsg = Nothing Set objOutlook = Nothing MsgBox "Email message sent to: " & eTo, vbExclamation, "Email Sent" End Function

The problem is, when Outlook is up and running, it takes no time at all to send the message. When Outlook is shut down it takes about 45 seconds to send the message. How could I speed this up?

Thank you for any replies.
Reply With Quote
Old 09-17-2003, 03:28 PM
chris00's Avatar
chris00 chris00 is offline
Join Date: Mar 2002
Location: Ohio, USA
Posts: 1,552


Unless you really want to do it using Outlook, I would recommend you write your own Email sending routing (using the Winsock control).

Take a look at this for some help : http://winsockvb.com/article.php?article_id=20
Reply With Quote
Old 09-17-2003, 06:41 PM
dgdolins1 dgdolins1 is offline
Join Date: Dec 2002
Posts: 124

"Start your e-mail client and log on before running the EmailTest app. You don't need to start your e-mail client first, but the initial message you send goes through much more quickly if you do, because the MAPI logon takes a while based on the connection speed to your e-mail server. Logging on in advance puts the initial MAPI logon time outside your application's startup time. Once you send one e-mail, subsequent messages send quickly as long as you don't destroy your mail objects between uses"

- http://msdn.microsoft.com/library/de...tml/gs0103.asp
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Common Dialog Question GGKauten General 13 11-20-2002 02:29 PM
read input from sound card dan1707 General 2 10-21-2001 09:52 AM
MS Winsocket gibson General 3 07-20-2001 10:03 AM
It's whats inside that counts! Dazz API 4 04-27-2001 05:16 AM


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..