Look for this line: session = mapi.MAPILogonEx(0, MAPIProfile, None, mapi.MAPI_EXTENDED |Īnd change it to session = mapi.MAPILogonEx(0, MAPIProfile, None, mapi.MAPI_EXTENDED |Ĭall SendEMAPIMail like this: SendEMAPIMail(SendSubject, SendMessage, SendTo, MAPIProfile=None)Ī dialog should appear offering to select the Outlook profile.Īs found out, if Outlook is running with another profile, MAPILogonEx seems to reuse the running session and its profile. Have a look at site-packages\win32comext\mapi\demos\mapisend.py of your pywin32 installation.Īs said in the comment, try the following to be sure Outlook is using the profile you want. it allows to select an outlook profile to be used.
This parameter lives under the OrganizationConfig noun. In order to enable this, we need to connect to Exchange Online using PowerShell and set the parameter Oauth2ClientProfileEnabled to true. It takes a little more effort than what you tried so far but it is very powerful, e.g. The first thing is to ensure modern authentication support is enabled in the Exchange Online tenant. Prone to email crashing when mail folder size increases. You can send mails via exchange using the extended mapi. The downsides to Microsoft Outlook should also be considered: More difficult to set up compared to Thunderbird Only supports Outlook aliases (no other email aliases) Cannot create flags, folders, and rules Only paid, licensed versions are available and. Set Use Cached Exchange Mode for new and existing Outlook profiles to Disabled. I'd rather send it from a generic account so that it looks more official and replies are received there instead of in my mailbox. Go to User Configuration > Administrative Templates > Microsoft Outlook 2016 > Account Settings > Exchange > Cached Exchange Mode. This identity is located in the Microsoft User Folder data.
This part works perfectly fine, but it sends the emails through the user that's logged in, myself. The Mac identity consists of a collection of email messages, tasks, contacts, accounts settings, calendars, and more.
Is there any way to accomplish this without using SMTP? Even just changing the headers to reflect the generic account as the From and Reply-To address would work.Įdit: Using Win7 32bit, Outlook 2010, python 2.7, and the pywin32 module to create the following bit of code: from win32com.client import Dispatch Trying something like msg.From = returns AttributeError: Property 'CreateItem.From' can not be set. I have access to this generic account (and password) and even have the mailbox opened concurrently in Outlook, if that helps. Regdelete "[HKEY_CURRENT_USER\Software\Microsoft\Office\16.I have a working script that creates and sends Outlook emails successfully through pywin32, but I would like to send the email from a different, generic account. Waithidden reg.exe delete "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Profiles" /v "Outlook" /f Below is a example of how I looped through all the accounts in my current Outlook profile (the one I have opened). will give you the default account seen from Account Settings. Waithidden reg.exe delete "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Profiles\outlook" /f You can use the Outlook 2010 Object Model to check the accounts in the current profile and find which one is the default account.
You can get it done with following steps: Step 1: Right click any blank place on your desktop, and select the Personalize from the right-clicking menu. For permanently changing to another profile, you need to change the default profile in the Control Panel. Status: Failed action uses wow64 redirection false Switch/change the default profile in Outlook. action uses wow64 redirection \_Download\LGPOtoApply.bat"ĭos reg delete "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Profiles\Outlook" /f Need help with the actionscript below: // Disable wow64 redirection on 圆4 OSes