wes peters
Thread Starter
- Joined
- Nov 5, 2002
- Messages
- 29
I don't know if my other post went through, I can't find it, so I'll try again. Sorry If it did go through I don't mean to double post.
I'm having trouble emailing directly from vb6. In my App. I open two different files, get there info, do some calculations and email the results to my client. My problem is that my email code only sends the info to my Microsoft Outlook. I then have to open Outlook and hit the send button and away it goes.
Here is my code:
Dim olapp As Object, oitem As Object
Dim confirm As Integer
On Error GoTo ErrHandler
Set olapp = CreateObject("Outlook.Application")
Set oitem = olapp.CreateItem(0)
If olapp Is Nothing Then ''' True if not running
Set olapp = CreateObject("Outlook.Application")
End If
confirm = MsgBox("Email this to customer?", vbOKCancel, "Confirmation")
If confirm = 1 Then
emadd = InputBox("Enter E-mail Address", "E-mail Address", Email)
With oitem
.Subject = "Window Quote"
.To = emadd
.Body = frmCustDat.Text1.Text
.Send
End With
''' Close the email document
Set olapp = Nothing
''' Quite the email application
Set oitem = Nothing
Else
MsgBox "Email not sent", vbOKCancel, "Cancel"
End If
ErrHandler:
Unload Me
End Sub
I have also tried MAPI code and it does the same thing.
Most of the email code isn't mine, but it seems to work to some extent.
Thanks, again for any and all help.
I'm having trouble emailing directly from vb6. In my App. I open two different files, get there info, do some calculations and email the results to my client. My problem is that my email code only sends the info to my Microsoft Outlook. I then have to open Outlook and hit the send button and away it goes.
Here is my code:
Dim olapp As Object, oitem As Object
Dim confirm As Integer
On Error GoTo ErrHandler
Set olapp = CreateObject("Outlook.Application")
Set oitem = olapp.CreateItem(0)
If olapp Is Nothing Then ''' True if not running
Set olapp = CreateObject("Outlook.Application")
End If
confirm = MsgBox("Email this to customer?", vbOKCancel, "Confirmation")
If confirm = 1 Then
emadd = InputBox("Enter E-mail Address", "E-mail Address", Email)
With oitem
.Subject = "Window Quote"
.To = emadd
.Body = frmCustDat.Text1.Text
.Send
End With
''' Close the email document
Set olapp = Nothing
''' Quite the email application
Set oitem = Nothing
Else
MsgBox "Email not sent", vbOKCancel, "Cancel"
End If
ErrHandler:
Unload Me
End Sub
I have also tried MAPI code and it does the same thing.
Most of the email code isn't mine, but it seems to work to some extent.
Thanks, again for any and all help.