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.
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.