UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Sendobject Not Sending Via Default Email Client, Access 2016    
 
   
johnpdmccall
post Jul 31 2020, 09:23 AM
Post#1



Posts: 1,866
Joined: 14-March 00
From: Ayrshire, Scotland


Hi Folks

I've got Outlook and Thunderbird installed.
Outlook has an email account configured
Thunderbird has the same email account configured.

Thunderbird is listed as the default email app.

The problem is that when I use SendObject to try to send an email it uses Outlook instead of Thunderbird.

This is despite re- configuring then restarting the computer.

The code below works fine on a clean virtual machine with only Thunderbird installed and no office apps. So I don't think it is the code.
I think Windows doesn't want to send via anything other than Outlook despit it not being set as the default email app.

Here's the code

CODE
Private Sub cmdSend_Click()
On Error GoTo errHandler
DoCmd.RunCommand acCmdSaveRecord
DoCmd.SendObject _
     , _
     , _
     , _
     Me.EmailAddress, _
    , _
    , _
    "Podiatry", _
    "Dear" & " " & Me!PatientName & Chr(13) & "" & Chr(10) & Chr(13) & "" & Chr(10) & Me!Body & Chr(13) & "" & Chr(10) & Chr(13) & "" & Chr(10) & "Best regards" & Chr(13) & "" & Chr(10) & Chr(13) & "" & Chr(10) & DLookup("CompanyName", "tblMyCompanyInfo"), _
False
MsgBox "Email sent", vbOKOnly, "Podware"

ErrHandler_Exit:
  Exit Sub

errHandler:
    MsgBox Err.Description
    
    Resume ErrHandler_Exit

End Sub

--------------------
Cheers,
John
Go to the top of the page
 
theDBguy
post Jul 31 2020, 09:39 AM
Post#2


UA Moderator
Posts: 78,612
Joined: 19-June 07
From: SunnySandyEggo


Hi John. That's interesting. I guess, maybe, Office/Access has a built-in preference. If this is the case, and you don't want to disable Outlook, you may have to try using a different method than SendObject. Just a thought...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
johnpdmccall
post Jul 31 2020, 09:47 AM
Post#3



Posts: 1,866
Joined: 14-March 00
From: Ayrshire, Scotland


Hi DBGuy, thanks for answering.
I'm already starting to use CDO in newer applications but the current application is already in use and it seems that there may have been changes in Office or Windows that don't allow users to have their own preference.
I hope I'm wrong because it will mean a lot of sorting out.

The main difficulty is that (well documented here and on the web already) Outlook throws up a warning message for every email that the user tries to send, then it pops the message in the outbox but doesn't send it until the user opens Outlook. Most of my users find that very clunky. They all have their own preferences in terms of email client.

It would be good to have a nice workaround until I can update everyone to my accdb that uses COD. All takes time :-)

--------------------
Cheers,
John
Go to the top of the page
 
mike60smart
post Jul 31 2020, 09:55 AM
Post#4


UtterAccess VIP
Posts: 14,077
Joined: 6-June 05
From: Dunbar,Scotland


Hi John

I have used the following in the past touse Thunderbird

CODE
Public Sub EmailViaThunderbird(pdfName As String, EmailTo As String, EmailCC As String)
Dim strShellcommand As String
Dim strThunderbirdCommand As String
Dim strTo As String
Dim strCC As String
Dim strSubject As String
Dim strBodyText As String
Dim strAttachment As String
strThunderbirdCommand = "C:\Program Files\Mozilla Thunderbird\thunderbird -compose"
strTo = EmailTo
strCC = EmailCC
strSubject = "Invoice No. " & Me.CboInvoiceNumberSelected & " Attached from Churchill Management Consultants Ltd"
strBodyText = "Please email to confirm receipt, thank you"
strAttachment = pdfName
strShellcommand = strThunderbirdCommand & " to='" & strTo & "',cc='" & strCC & "',subject='" & strSubject & "',body=' " & strBodyText & "',attachment='file:///" & strAttachment & "'"
Debug.Print strShellcommand
Call Shell(strShellcommand, vbNormalFocus)
End Sub

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
johnpdmccall
post Jul 31 2020, 10:05 AM
Post#5



Posts: 1,866
Joined: 14-March 00
From: Ayrshire, Scotland


Thanks Mike,

I'll give it a try. thumbup.gif

I'm down in sunny Warwickshire just now. 33 degrees warm. Gonna feel frozen when I get home to Ayrshire tomorrow!

--------------------
Cheers,
John
Go to the top of the page
 
mike60smart
post Jul 31 2020, 10:22 AM
Post#6


UtterAccess VIP
Posts: 14,077
Joined: 6-June 05
From: Dunbar,Scotland


Hi John

27 here in Sunny Dunny


--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
ADezii
post Jul 31 2020, 12:34 PM
Post#7



Posts: 3,095
Joined: 4-February 07
From: USA, Florida, Delray Beach


QUOTE
The main difficulty is that (well documented here and on the web already) Outlook throws up a warning message for every email that the user tries to send, then it pops the message in the outbox but doesn't send it until the user opens Outlook. Most of my users find that very clunky. They all have their own preferences in terms of email client.

  1. I do believe that the Warning Message you are encountering is 'A program is trying to send an e-mail message on your behalf'.
  2. You may have a couple of Options here, Mike.
    1. Option 1:
      • In Outlook, select File, then Options.
      • Click on the Trust Center, then Trust Center Settings.
      • Click Programmatic Access.
      • Select Options 1 or 2 (not recommended) to disable this Warning Message (see Image).
    2. Option 2:
      • If none of these Programmatic Access Security Options are available, start Outlook in Elevated Mode (Run this program as an administrator.
      • You should now be able to change the Settings.
  3. Hope this helps.


Attached File(s)
Attached File  Outlook.JPG ( 42.95K )Number of downloads: 2
 
Go to the top of the page
 
DanielPineault
post Jul 31 2020, 07:23 PM
Post#8


UtterAccess VIP
Posts: 7,434
Joined: 30-June 11



To send email using Thunderbird see: https://www.devhut.net/2020/03/07/vba-send-...la-thunderbird/

--------------------
Daniel Pineault (2010-2020 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    6th August 2020 - 05:40 AM