Erwin Craps - IT Helps
Erwin.Craps at ithelps.eu
Tue Feb 20 17:54:22 CST 2007
Euh, Maybe I'm wrong with this but isn't CDO only available on a server running Exchange Server? -----Oorspronkelijk bericht----- Van: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] Namens David Emerson Verzonden: dinsdag 20 februari 2007 19:38 Aan: Access Developers discussion and problem solving Onderwerp: Re: [AccessD] Automating email Thanks Kath and Erwin, I eventually found some code that doesn't rely on outlook but uses another file called CDOEx.dll. It doesn't leave any items in outlook. In references you need to set the reference to Microsoft CDO for Exchange 2000 Library Public Function SendCdoMsg() On Error GoTo Err_SendCdoMsg Dim msg As Message Set msg = CreateObject("CDO.Message") With msg With .Configuration.Fields .Item(cdoSMTPAuthenticate) = cdoAnonymous .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = "smtp.xtra.co.nz" .Item(cdoSMTPConnectionTimeout) = 10 .Item(cdoSMTPServerPort) = 25 .Update End With .Organization = "my" .To = "you at yourprovider" .Subject = "Example subject" .TextBody = "Example body" .From = "me at myprovider" .AddAttachment ("d:\aaaatemp\accarch135.zip") .Send End With Set msg = Nothing Exit_SendCdoMsg: Exit Function Err_SendCdoMsg: Select Case Err Case 0 MsgBox "0 error", vbCritical, "Error heading" Case Else Call basErrorMsg("SendCdoMsg") End Select Resume Exit_SendCdoMsg End Function At 20/02/2007, you wrote: >Hi David - I only use the .Display option in my apps so that the users >can add some text to the email if they want to before it is sent, but >.send WILL send the email depending on their Outlook preferences. > >ie. if they have [tools] [options] [mail delivery] 'Send immediately >when connected' turned on, then yes, it will send. > >I haven;t found any way of that email not going into sent items though. > >Kath > > ----- Original Message ----- > From: David Emerson > To: accessd at databaseadvisors.com > Sent: Tuesday, February 20, 2007 11:31 AM > Subject: [AccessD] Automating email > > > Group, > > I have the following code to create an email message: > > Public Function basSendEmail() > > Dim outApp As Outlook.Application, outMsg As MailItem > > Set outApp = CreateObject("Outlook.Application") > Set outMsg = outApp.CreateItem(olMailItem) > > With outMsg > .To = "newsgrps at dalyn.co.nz" > .Subject = "Test egas email" > .Body = "Test message" > .Send > End With > > Set outApp = Nothing > Set outMsg = Nothing > > End Function > > This works fine but only puts the message into my Outlook outbox - it > doesn't send it. This may be because although I have outlook > installed I do not use it (and it has not been set up). > > However, my clients use outlook. Will the above code automatically > send out emails? > > Another question - My client would prefer not to have copies in their > outbox of the email being sent out (ultimately it will be to email > out accounts and they don't want thousands of emails generated each > month). Is there a way for the messages not to appear in outlook? > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com