SOLVED

Sending Email

Copper Contributor

Send email problem    when i display the email to check it.  i click on "Send" the email doesn't appear in my inbox.   Below is the code i am using  Any help would be greatly appreciated.

Private Sub Command228_Click()
Dim oApp As Outlook.Application
Dim oMail As MailItem
Set oApp = CreateObject("Outlook.application")

Set oMail = oApp.CreateItem(olMailItem)
oMail.Body = "Hi All" & vbCrLf & vbCrLf & _
"I have a casino in:" & " " & Me.Venue_City & vbCrLf & _
"Show Time:" & " " & Me.Show_Time & " " & "Event Time:" & " " & Me.Party_Time & vbCrLf & vbCrLf & _
Me.Blackjack & " " & "(" & "Blackjack" & ")" & vbCrLf & _
Me.Craps & " " & "(" & "Craps" & ")" & vbCrLf & _
Me.Roulette & " " & "(" & "Roulette" & ")" & vbCrLf & _
Me.Poker & " " & "(" & "Poker" & ")" & vbCrLf & _
Me.[3 Card Poker] & " " & "(" & "3 Card Poker" & ")" & vbCrLf & _
Me.[Let it Ride] & " " & "(" & "Let it Ride" & ")" & vbCrLf & _
Me.[Pai Gow] & " " & "(" & "Pai Gow" & ")" & vbCrLf & _
Me.[Money Wheel] & " " & "(" & "Money Wheel" & ")" & vbCrLf & vbCrLf & vbCrLf & _
"Stacie Noseworthy PCA" & vbCrLf & _
"Vice President" & vbCrLf & _
"CCP Events Inc" & vbCrLf & _
"1540 Westfork Dr. Suite 108" & vbCrLf & _
"Lithia Springs, GA 30122"

 

oMail.Subject = "New Event Sign-Up"
oMail.To = "email address removed for privacy reasons"
oMail.Display
Set oMail = Nothing
Set oApp = Nothing
End Sub

8 Replies
best response confirmed by marklbdrummer (Copper Contributor)
Solution
This may not be the problem, but it sure does not look good when you're mixing early binding and late binding.
Change to:
Set oApp = New Outlook.Application

Assuming oMail.To is set to your email address, it should be sent (briefly show in your outbox) when you click Send, and shortly thereafter show in your inbox. It did for me.
This assumes no spam filter intervened.
You can also Save the email while previewing it, and it should show in your Drafts folder.
Thank you Thats seems to be the answer. Would you happen to know how to create a group to email to?
In the desktop version of Outlook (note: not New Outlook): Contacts > New Contact Group.
What i an looking for is to choose a name in a combo box and for it to put that persons email in the To field in the email
oMail.To = Forms!YourForm!YourCombobox
sorry not making sense, maybe i am not explaining it very well i have the combo box not attached to a table once i choose the name in the box i want it to look up the name in a list and put that persons email in a blank textbox from there put the information in the TO field in the email, unless you have an easier way Thabks
Start a new question, and try describing your situation very clearly.
For example, if the combobox is not bound to a table, how does it get its data? I will watch from the sidelines though.
Thanks anyway
1 best response

Accepted Solutions
best response confirmed by marklbdrummer (Copper Contributor)
Solution
This may not be the problem, but it sure does not look good when you're mixing early binding and late binding.
Change to:
Set oApp = New Outlook.Application

Assuming oMail.To is set to your email address, it should be sent (briefly show in your outbox) when you click Send, and shortly thereafter show in your inbox. It did for me.
This assumes no spam filter intervened.
You can also Save the email while previewing it, and it should show in your Drafts folder.

View solution in original post