a macro that emails

  • Thread starter Thread starter Justin
  • Start date Start date
J

Justin

I am running reports on employee goals. I want to know
if it is possible in Access to make a macro that will
automatically email employees if they aren't meeting
their goal dates.
 
try pasting these two functions in a module
will work on Windows 2000 and XP

Billy.

Public Function GetSMTPServerConfig() As Object

Dim objConf As Object, colFlds As Object

Set objConf = CreateObject("CDO.Configuration")
Set colFlds = objConf.Fields

' Set the configuration for Network Send
colFlds
("http://schemas.microsoft.com/cdo/configuration/sendusing"
) = 2 ' cdoSendUsingPort
' The IP Address of the PC the SMTP server is on.

colFlds
("http://schemas.microsoft.com/cdo/configuration/smtpserver
") = "111.111.111.1" 'your mail server's ip address
colFlds
("http://schemas.microsoft.com/cdo/configuration/senduserna
me") = "username"
colFlds
("http://schemas.microsoft.com/cdo/configuration/sendpasswo
rd") = "yourpassword"
colFlds
("http://schemas.microsoft.com/cdo/configuration/smtpserver
port") = 25
colFlds
("http://schemas.microsoft.com/cdo/configuration/smtpauthen
ticate") = 1
colFlds.Update

Set GetSMTPServerConfig = objConf
Set objConf = Nothing
Set colFlds = Nothing

End Function


Function SendEmail(Sender As String, Receiver As String,
Subject As String, _
BodyText As String, Optional Cc As String, _
Optional Bcc As String)

Dim objMail As Object
Set objMail = CreateObject("CDO.Message")

Set objMail.Configuration = GetSMTPServerConfig()
objMail.To = Receiver
objMail.From = Sender 'This MUST be a well-formedadress or
you'll get an error.
objMail.Subject = Subject
objMail.Cc = Cc
objMail.Bcc = Bcc
objMail.TextBody = BodyText
objMail.send

Set objMail = Nothing

End Function()
 
try pasting these two functions in a module
will work on Windows 2000 and XP

Billy.
[code snipped]


hi Billy,

looks like a great way to integrate email in your applications.

do you also know a way to receive eMail with cdo and these schemas ?

greets,

Joe.
 
Back
Top