Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending e-mail without Outlook and without SendObject

Status
Not open for further replies.

TrojanRabbit

Programmer
Apr 4, 2002
190
US
I'm trying to find a good way to send e-mail in Access2000. We were using Winsock, but Access suddenly won't recognize it anymore. The SendObject command is not working for us, either. The error I get with Winsock is 'Object does not support property or method.' I have the OLE Automation and Winsock Control 6.0 library references checked. It apparently worked until now. I don't know of any changes to our systems. It is using the same file it did before (mswinsck.ocx).

We don't use Outlook, but we do have Eudora that can be used if necessary. I also need to send from a dummy address. What ways are there to do so?
 
Under access 2000, you should consider using VBA automation. Here is an example from Microsoft on sending an e-mail via Outlook.

Sub sendMessage(Optional AttachmentPath)

Dim olookApp As Outlook.Application
Dim olookMsg As Outlook.MailItem
Dim olookRecipient As Outlook.Recipient
Dim olookAttach As Outlook.Attachment

' create the Outlook session.
Set olookApp = CreateObject("Outlook.Application")

' create the message.
Set olookMsg = olookApp.CreateItem(olMailItem)

With olookMsg
' add the To recipient(s) to the message.
Set olookRecipient = .Recipients.Add("Christopher Wyke")
olookRecipient.Type = olTo

' add the CC recipient(s) to the message.
Set olookRecipient = .Recipients.Add("Robert Dil")
olookRecipient.Type = olCC

' set the Subject, Body, and Importance of the message.
.Subject = "This is an Automation test with Microsoft Outlook"
.Body = "Last test - I promise." & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance

' add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set olookAttach = .Attachments.Add(AttachmentPath)
End If

' resolve each Recipient's name
For Each olookRecipient In .Recipients
olookRecipient.Resolve
If Not olookRecipient.Resolve Then
olookMsg.Display ' display any names that can't be resolved
End If
Next
.Send

End With
Set olookMsg = Nothing
Set olookApp = Nothing

End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top