Send mail from Access with Outlook Expr. - TechRepublic
General discussion
October 12, 2001 at 05:03 AM
andersos

Send mail from Access with Outlook Expr.

by andersos . Updated 24 years, 7 months ago

When I try to send mail from access using CDONTS, this code works until I actually get to the “Send” line. Then I get an error message. The documentation from microsoft seems to say that this is not supported from a PC (not a server) in the currentrelease of CDONTS. Any ideas? Installing the full version of Outlook is not an option. Also updating dll’s may not be possible. This application is used by external users that are not very computer literate. Getting access to their PC’s (300 +)is not easily accomplished.

Function SendNewMail()
Dim objNewMail As Object

On Error GoTo error_olemsg

Set objNewMail = CreateObject(“CDONTS.NewMail”)

Call objNewMail.AttachFile(“C:\Temp\Test.xls”, “Test.xls”)
objNewMail.From = “person@company.com”
objNewMail.To = “person2@company.com”
objNewMail.Subject = “Territory Planner Changes”
objNewMail.Body = “Territory Planner Changes from Stephen Anderson”
objNewMail.Send
Set objNewMail = Nothing

Exit Function

error_olemsg:
MsgBox “Error ” & Str(Err) & “: ” & Error$(Err)
Resume Next

End Function

This discussion is locked

All Comments