Erwin Craps - IT Helps
Erwin.Craps at ithelps.eu
Tue Feb 20 02:49:49 CST 2007
If you are not using Exchange server but a internet account and did not specified a valid smtp server, it is normal that your e-mail stays queded in the outbox. However, I seen it before in my programming that e-mails don't get send in one situation I believe it was a Outlook bug (thats solved in the meanwhile but since then I always also do this. I stronly suggest to resolve the recipients before sending. With outMsg .To = "newsgrps at dalyn.co.nz" .Subject = "Test egas email" strHTMLOriginalEmailBody = .HTMLBody strHTMLBody =" Hi this is my text in the e-mailbody" .HTMLBody = strHTMLBody & strHTMLOriginalEmailBody .Display .Recipients.ResolveAll .Send End with The .Display is no longer needed because the Outlook bug display/resolve is solved when you are fully updated. The reason why you need to display first (when bug is present) is that the resolve does not work when the message is hidden. Resolving the recipients will check if all e-mailaddresses are correct formatted and or exisisting in the contacts. Please also note that if the user has a E-mail footer it will disapear when simply dooing .body = "message" You need to store the body from the newly created mailitem and add it afterwards. Because Outlook is using by default, and most people do, HTML based e-mail you need to work with the .HTMLbody instead of the .body. If you mix both you gonna get some mish mash body :-) Hope this helps Greets -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kath Pelletti Sent: Tuesday, February 20, 2007 1:58 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Automating email 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