Sending Email Via Access...

D

DanielWalters6

I am planning to build a IT Lab booking system in Acccess.

I'm looking for a way to automatically email the member of staff at the
college who has booked the room, confirming the time and date of their
booking.

I have found some ways in which I've been able to issue an email with this
information in, using the client's outlook, however this isn't a proper
solution...

I am running in an environment where staff will be able to look at the
database which will be held on our "shared" drive.

Is anyone aware of how to generate an email from Access itself without
having to use Outlook as an interface?

Some users might not have their preferred mail client open, and cannot rely
on some of the staff laptop's having Outlook.

Any help/advice or tips you can provide me with are all appreciated.

Dan Walters
 
D

DanielWalters6

Thank you for your help.



------

'##########################################################################################################################



'Sending a small message using default text format



Dim iMsg As Object ' imap object

Dim iConf As Object 'imap configuration

Dim strbody As String 'body of email

Dim Flds As Variant 'various config fields



'###########################################################



Set iMsg = CreateObject("CDO.Message") 'give me a new email
object

Set iConf = CreateObject("CDO.Configuration") ' and a new
configuration object



iConf.Load -1 ' Source Defaults – housekeeping stuff

Set Flds = iConf.Fields



'###########################################################



'configue email object to point to our server



Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.yourisp.net" ‘name of the smtp server goes here


Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
25

Flds.Update



'if you also get the Authentication Required Error you can add this three
lines before the update line although I didn’t find it necessary.


'.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

'.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")
= "username"

'.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")
= "password"


'#################
'Create up the body of the message

strbody = "Hi there" & vbNewLine
strbody = strbody & "This is line 2" & vbnewline
strbody = strbody & "This is line3" & vbnewline



'####################



'Set up the addresses and other bits of the email



Set iMsg.Configuration = iConf

iMsg.To = "(e-mail address removed)"

iMsg.CC = ""

iMsg.BCC = ""

iMsg.From = """Ron"" <[email protected]>"

iMsg.Subject = "Important message"

iMsg.TextBody = strbody



'###################

'Send it



iMsg.Send

'########################
Set iMsg = Nothing

Set iConf = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top