Choosing "From" field using python win32com outlook - python

I am trying to automate emails using python. Unfortunately, the network administrators at my work have blocked SMTP relay, so I cannot use that approach to send the emails (they are addressed externally).
I am therefore using win32com to automatically send these emails via outlook. This is working fine except for one thing. I want to choose the "FROM" field within my python code, but I simply cannot figure out how to do this.
Any insight would be greatly appreciated.

If you configured a separate POP3/SMTP account, set the MailItem.SendUsingAccount property to an account from the Namespace.Accounts collection.
If you are sending on behalf of an Exchange user, set the MailItem.SentOnBehalfOfName property

Related

How to send chat messages to individuals by email address using Google Chat API?

Some Context
So, I'm developing a task that analyzes several groups of data from a website and then sends a notification to the person who is tied to that group of data. From the groups of data, we are able to retrieve the person's email address as well as their name and some other personal identifying information.
The Goal
All of these users are part of a the same Google group. What we'd like to do is send them (the individual user tied to the data group) the notification and relevant data as a Google Chat message—their primary form of communication.
What I Understand
The Google Chat API seems to have some cool HTTP API requests available for the purpose of chatbots, but after searching around and viewing their references, it seems that this API is not used as anything more than as a chatbot or similar. It seems to need webhooks or some sort of account ID in order to create a message to someone in particular.
The Question
So, my question is as to whether or not there is a way to use the Google Chat API to send a message to a particular individual in the workspace identified by their email address.
My particular instance uses python, but if there were code/concepts in another language or whatever, please share. Thanks!
I think you may find this other post useful. You are pretty much correct about how the API works. As described in the official documentation about the Google Chat API, everything is done using bots.

How to send emails according to user request in python?

How do i send an email whenever a user requests it?. I thought on a script that sends mails every hour with some content relevant for the recipients, but I dont like the idea of spamming mail to other people. So i would like to send this mail whenever the recipients wants it. For example if this user sends me a mail with a keyword, i would like the sript to run and send the mail back with the content already made up. So, there is no spam and information is sent in a more efficient way.
I appreciate your help in advance.
This is a pretty complex and broad question.
First off, you would need a server or your PC to have the script running all the time or periodically fire off via cron.
Secondly, you would need to keep some kind of job queue where you would register that a user has sent you an email requesting that you send them one in response. There are well developed and complex job queues like Celery, but you could potentially do with something less complex - maybe a Google Sheets table.
Thirdly, you would need to parse emails you receive in order to get the keywords and email addresses. If you go the gmail + google sheets route, you could do it with some custom code probably, but otherwise you would need to implement email checking on your PC or server. Once you parse them, you add them to the jobs queue.
Finally, you need to provide email access to your Py script - meaning SMTP login. The docs have more on this.
As you can see, there are a lot of things to consider and implement, so you maybe better off trying to narrow down your question a bit. :)

Automated emails via Microsoft Graph

Is it possible to send auto responses via Microsoft Graph from an O365 email address?
I am building a booking system using Python and Graph in which School's can book online educational sessions. Once they've finished the booking process I would like automated emails to be sent to them and the company. Is this possible via graph without a user being logged in or will I have to use something like SendGrid instead?
I know sending emails once signed in is simple enough but I just need automation from something such as noreply#companyname.com.
Thanks!
Yes, you can send emails from an O365 email address by using Sendmail call.
You need to create Azure AD based workflow (say, daemon based app
will work in your scenario). Here's the sample
In case of
bulk emails and outside of Graph, yes you can consider options like
sendgrid!!

Checking folders different than inbox using poplib in Python

Some time ago I ve written a Python script, using poplib library, which retrieves messages from my pop3 email account. Now I would like to use it to retrieve emails from different mail server which works with IMAP. It works well, but only to retrieve messages from Inbox. Is there any way to also get emails from other folders like Spam, Sent etc? I know I could use imaplib and rewrite the script, but my questions is if it's possible to obtain that with poplib.
No.
POP is a single folder protocol. It is very simple and was not designed for multiple folders.
You will need to use IMAP or other advanced protocols to access additional folders.

Fetch mails from another mailbox in Google App Engine

I am trying to fetch mails from another mailbox (xxx#domail.com or xxx#gmail.com) in google-app-engine.
I don't want to read mails from appspotmail box as it is being used for different purpose.
Is there any efficient way in which i can make this happen.
Two options:
You could read an inbox via POP/IMAP, but this requires a bit of coding. You also need to have Outgoing Sockets API enabled, which requires you to have a paid app. This approach is async, which means you will constantly need to poll for new messages.
Forward emails to a new appspotmail address (you can have many). This is pretty easy, especially since you already process incoming emails. Since you can have multiple accounts, e.g. xyz#yourappid.appspotmail.com, you can distinguish between them in code.
You can use imap+oauth to read email from a google address. If you google it the very first result is what you need. https://developers.google.com/gmail/oauth_overview

Categories