Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

email from vb6 app won't send till outlook is run

Posted on 2005-05-04
13
Medium Priority
?
244 Views
Last Modified: 2010-05-02
I am using this code to email a registration request from an app i am writing to my emmail address.
 Problem is it queues the emails till I open Outlook, which is not my default email client.
The emails are then sent. I am using this system of sending the requests because I understood it would allow the user to send without an Outlook window being opened, and hence be more convenient
 Why is it queueing the out traffic and not sending it immediately, please?

Here is the function doing the sending:
(MYADDRESS is a string constant containing a valid email address)

' ==========================================================
' send emails,  using :    outlook 10.0 object library
'==========================================================
Public Function SendMyMessageNow(ByVal sThisInfo As String, _
                                                     ByVal sTextOfMessage As String) As Boolean

Dim objOL As Outlook.Application
Dim MyMail As MailItem

On Error GoTo ErrHandler

Set objOL = CreateObject("Outlook.Application")
Set MyMail = objOL.CreateItem(olMailItem)
   
    With MyMail
        .To = MYADDRES
        .Subject = "Registration request: "
        .Body = sThisInfo & " > " & sTextOfMessage
    End With
   
    MyMail.Send

    Set MyMail = Nothing
    Set objOL = Nothing

    SendMyMessageNow = True
   
Exit Function

ErrHandler:
    MsgBox (Err.Number & vbCrLf & _
            Err.Description & vbCrLf & _
            " Error in SendMyMessageNow ")
    SendMyMessageNow = False
   
End Function



0
Comment
Question by:bantamb20
  • 8
  • 5
13 Comments
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13933594
Just out of curiousty, comment the sendmymessagenow = false out ie in this chunk of code :

ErrHandler:
    MsgBox (Err.Number & vbCrLf & _
            Err.Description & vbCrLf & _
            " Error in SendMyMessageNow ")
   ' SendMyMessageNow = False <-- Comment that out

Also what about using MAPI instead of outlook ?
0
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13933606
If you could write your email address in your profile something like :

user<AT>domain<DOT>com

and let me know once you have done that I have a mapi example that egol sent me. Which I would be able to send to you :)
0
 

Author Comment

by:bantamb20
ID: 13933641
email address added to profile.
maybe mapi is easier, i don't know, this seemed pretty simple...

i have tried commenting out the line you suggest, no difference

The queued email does not go till I open Outlook and click send/receive. I forgot to mention that was a necessary step.
 
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13933684
I uploaded it to some webspace :

http://www.geocities.com/lucky_lizard2003/mapi.html
0
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13933692
You can take your email address off of your profile now if you want :) Up to you.
0
 

Author Comment

by:bantamb20
ID: 13933738
Download MAPI link gives a "Sorry the page you requested was not found" message
0
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13933749
I emailed it to you :) Did you get that.
0
 

Author Comment

by:bantamb20
ID: 13933779
My ISP spam-filters my emails for once-only addresses. You may need to send twice more to show you mean business . . .
0
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13933807
ok I have sent it 3 times now, if that does not work, let me know.
0
 

Author Comment

by:bantamb20
ID: 13933849
if you are using yahoo.anything it will be chucked out. I have reset to allow yahoo.com, but nothing has shown up here
0
 
LVL 23

Accepted Solution

by:
gecko_au2003 earned 800 total points
ID: 13933902
ok go here and let me know if you can download it from here :

http://192.168.2.3/
0
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13934034
So you got it now and it works ?
0
 

Author Comment

by:bantamb20
ID: 13934283
Yes thanks though I won't be able to test it fully for a while. This is a spare time programme.
But thanks for the interest and enthusiasm.
Some of that stuff must have taken a while to debug . . . ???

Cheers

Oh by the way i'm drawing a scaleable map with line and circle and such-like.
Can you point me to any tidier and more accurate way of drawing straight lines? Lines near vertical or horizontal are stepped and clunky . . .

Thanks again, points are on the way.
Colin Lundy
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month20 days, 16 hours left to enroll

864 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