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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send email from msaccess 2003

Status
Not open for further replies.

toptech

Programmer
Apr 12, 2001
71
US
Hi There.

I have been trying to send email via msaccess 2003.
I have copied and this code from the tek site, but something is still not working.

I have created an module with the following function.

when I execute the function - I get no error message, but I receive no email either.

can anyone see what is wrong with my code?

Thanks in advance.

Jeff

Public Function cid_mail()

Const cdoSendUsingPickup = 1
Const cdoSendUsingPort = 2 'Must use this to use Delivery Notification
Const cdoAnonymous = 0
Const cdoBasic = 1 ' clear text
Const cdoNTLM = 2 'NTLM
'Delivery Status Notifications
Const cdoDSNDefault = 0 'None
Const cdoDSNNever = 1 'None
Const cdoDSNFailure = 2 'Failure
Const cdoDSNSuccess = 4 'Success
Const cdoDSNDelay = 8 'Delay
Const cdoDSNSuccessFailOrDelay = 14 'Success, failure or delay

Set objMsg = CreateObject("CDO.Message")
Set objConf = CreateObject("CDO.Configuration")

Set objFlds = objConf.Fields
With objFlds

.Item(" = 2525
.Item(" = cdoSendUsingPort
.Item(" = "smtp.cid.ca" 'smtp server
.Item(" = cdoBasic
.Item(" = "user@cid.ca" 'to authenticate
.Item(" = "password"
.Update
End With

strBody = "This is a sample message." & vbCrLf
strBody = strBody & "It was sent using CDO." & vbCrLf

With objMsg
Set .Configuration = objConf
.To = "jfeintuch@rogers.com"
.From = "user@cid.ca"
.Subject = "This is a CDO test message"
.TextBody = strBody
'use .HTMLBody to send HTML email.
' .AddAttachment "E:\users\shared\access\Order_Extractor.xls"
' .Fields("urn:schemas:mailheader:disposition-notification-to") = "me@my.com"
' .Fields("urn:schemas:mailheader:return-receipt-to") = "me@my.com"
.DSNOptions = cdoDSNSuccessFailOrDelay
.Fields.Update
.Send
End With
End Function

Top Tech Systems

If you help 3 people and each one of those help 3 other people and so on, imagine all the people being helped.
 
Have you tried stepping through the code? That's usually the first thing I do to see where it's stopping/breaking, or basically WHAT is not working.

--

"If to err is human, then I must be some kind of human!" -Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top