How to set sender in Outlook pop account using a Applescript

ChangeAgent 96 Reputation points
2021-12-02T08:10:58.257+00:00

I like to create a Applescript to send mails I need to send regular. I have several POP accounts and I want it to select a specific one. That is where I get stuck. Anybody know how to do this?

Here is the script so far.
tell application "Microsoft Outlook"
set theContent to "Mail Content etc."
set theMessage to make new outgoing message with properties {subject:(("Month ") & (do shell script "date '+%m'")), content:theContent}
make new recipient with properties {email address:{address:"to@Monique gmx .com"}} at end of to recipients of theMessage
make new recipient with properties {email address:{address:"to2@Monique gmx .com"}} at end of cc recipients of theMessage
open theMessage
end tell

Script works fine but I do not know how to get it to select one of the POP accounts and the related signature.

PS I had this posted here
https://answers.microsoft.com/en-us/outlook_com/forum/all/how-to-set-sender-in-outlook-pop-account-using-a/634c369b-89f3-4f6e-b70e-efa53dae30dd
and it was suggested to ask here.

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
866 questions
Office Mac
Office Mac
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Mac: A family of Apple personal computers that run the macOS operating system.
457 questions
0 comments No comments
{count} votes

Accepted answer
  1. ChangeAgent 96 Reputation points
    2021-12-11T14:57:38.133+00:00

    Ok folks, got it, here it is:

    tell application "Microsoft Outlook" 
    set theAccount to the first pop account whose name is "The-name-of-the-account-you-want-to-use" 
    set theContent to "Mail Content etc." 
    set theMessage to make new outgoing message with properties {account:theAccount, subject:"Test", content:theContent} 
    make new recipient with properties {email address:{address:"to@mail.com"}} at end of to recipients of theMessage 
    make new recipient with properties {email address:{address:"to@mail.com"}} at end of cc recipients of theMessage 
    open theMessage 
    end tell
    

    Posted in case anybody else is looking for it.


4 additional answers

Sort by: Most helpful
  1. John Korchok 4,926 Reputation points
    2021-12-02T17:08:01.26+00:00

    This being a Microsoft site, you won't find much AppleScript expertise here. Here's a web site that might help: Microsoft Office VBA to AppleScript. Office 2008 for Mac was missing VBA, so the site was published to help Mac users to automate Office with AppleScript. The site has a section on Entourage, the predecessor to Outlook on the Mac. It may have some sample scripts that will get you headed in the right direction.

    In the same vein, I host a copy of the Microsoft Office 2008 AppleScript documentation, available on this page: https://www.brandwares.com/Downloads.php

    0 comments No comments

  2. ChangeAgent 96 Reputation points
    2021-12-02T17:56:17.2+00:00

    Hi John, thanks for your reply. As said I was send here from an other MS forum.

    I speed-read through the VBA info, but that did not help.

    I followed your other link and there is interesting stuff. I could not find (a quick look) any answers as to Outlook 365.

    Do you know how to solve this?


  3. ChangeAgent 96 Reputation points
    2021-12-03T15:47:54.097+00:00

    no worries John thanks for chipping in. anybody know the solution?

    0 comments No comments

  4. ChangeAgent 96 Reputation points
    2021-12-11T15:22:42.33+00:00

    you are welcome John, hope it helps others.

    0 comments No comments