Check exchange mailbox from powershell - powershell

Is it possible to check if an Exchange email account from powershell? I read this post but it's very dated and I've seen many references to sending mail from powershell but none to retrieve mail.
This is a "poor mans" solution to monitoring and somewhat of a synthetic transaction generator.
In short, I want to send an email from powershell and check email from powershell.

Easiest way to retrieve emails from Office 365 is to use the Graph API.
You'll first need to authenticate to it, if this is going to be an automated solution you would need to authenticate as a Application.
https://learn.microsoft.com/en-us/graph/auth-v2-service?context=graph%2Fapi%2F1.0&view=graph-rest-1.0
Then you can list emails using this endpoint
https://learn.microsoft.com/en-us/graph/api/user-list-messages?view=graph-rest-1.0&tabs=http
And send an email using this endpoint
https://learn.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http

Related

Can I post a new topic on a google group using Go?

I'm writing a program that should send emails to multiple users with content extracted from an excel spreadsheet. I know how to do this using the net/smtp package in Go, but I would like to know if it's possible to send an email with the sender being a google group (i.e googlegroup#gmail.com) instead of my email without resorting to using the gmail API? Currently I have a working program that can log in through an email and password, which is then used for auth credentials, but seeing as that google groups don't have the same kind of interface I'm not quite sure how to change it so emails are sent from a group instead of an individual user.
Each google group should have an email address associated with it. golang-nuts is golang-nuts#googlegroups.com for example. Any mail sent to that should be posted to the group, assuming it is from a member of the group.
In order to send from your own gmail account, you can use gmail's outgoing smtp feature with the net/smtp package. Configuration is explained better on this digital ocean post

Proper Way to Programatically Send Mail Using Google Apps

I have a domain which uses Google Apps for Business to handle email. I already have it mostly set up--MX records point to the correct location and my domain is verified.
I'm now writing a python app (with Django) that will need to serve mail from my domain. What's the correct way to do this with Google? Should I create a Google Apps "user" for the organization as a whole, and then authenticate via SMTP as that user and send mail from there?
The Gmail API says that it
is the best choice for authorized access to a user's Gmail data.
and that
Automated or programmatic message sending
is a typical use case. However, I'm not trying to access a user's data or send mail on behalf of a user, but on behalf of my domain. What's the correct way to proceed?
Any help much appreciated!
You could use SMTP or the Gmail API based on your description. In both cases, you'll need some sort of service account to send mail from. With SMTP, as you mentioned, you'll be authorizing via the instructions you linked.
If you choose to use the Gmail API route, you'll be authorizing the API usage with the account. The Gmail API has many other use cases (e.g. to access user's data) but you're only using it to send emails on behalf of a service account you control.

How to migrate Notes mail agents to Microsoft Exchange (i.c. Office365)?

A client insists on moving from Notes/Domino to Office365 (no further comments on that please). There are some mail agents that provide automated functionality. In one case, it is an agent in a mail database that, when it receives a mail, it responds with a mail that contains a unique reference for the mail just received. It's their way to generate unique mail references.
How to create an alternative solution, in Office 365? Can one develop an agent in Office365?
If it must be an equivalent solution, does it have to be an Outlook client that's always on?
Or are there other ways to generate reply mails from a special mail account?
Can one send a mail to an SQL server, for instance?
I'm open to all your suggestions! Thanks.
I'd do some research into what's currently available for Office365 users via Exchange Web Services - or better yet, the Exchange Web Services Managed API.
Assuming that you Office365 gives you full access through Exchange Web Services, you can write code to use the subscription/notification services for the mailboxes that you want to monitor, and then have your code send the emails.
There may also be better ways.

Writing a job that can access office 365 email and migrate them elsewhere

I need a little help understanding a task I have been given.
I started work on a 'SharePoint focused' team and we are trying to create a SharePoint portal that would house/manage all incoming mail to a specific company email address.
We have had a couple of issues setting up SharePoint to accept incoming mail, so have begun looking at other possible options.
1 option that was suggested was to 'write a job' that would read our mailbox server (on Office 365), and then find, pull and migrate/copy selected emails onto the sharepoint site.
(something else we are also interested in doing is seeing what info we can grab from these emails at this stage which we can use to create various mail objects in sharepoint with the mail metadata. Not sure what limitations there are to what can be accessed, if anything)
Is somebody able to explain a little more the type of process or work that is required to do this (access Office 365 mail via some API which we can create a timed job for), and any experience or advice around it? Where would I start looking or how would I start implementing it, etc.
Thanks!
You combine couple of things together. SP can read incoming emails through locally installed and configured SMTP server. You can then setup document library or list to store them or create event listener to handle incoming emails completely by your own.
But both cases (OOTB functionality or event receiver) rely on local SMTP. If you want process emails from other server like Exchange Online you must either forward these emails to local SMTP server installed beside SP or you must create your own code. It can be SP job or any other type like windows service or console application executed by windows schedule, ... calling Exchange online API (designed specially for Exchange online) or MAPI or POP3 (generic using libraries) to get emails and calling SP API (CSOM, REST API) to store emails.

Take data from an email and upload it to Microsoft Sharepoint 2010

I have an email that arrives every day at 5:00 PM which reports the amount of inventory in stock everyday. Is there a way I could upload the data from this email into Microsoft Sharepoint 2010 ? I searched Google and StackOverflow but didn't find a solution to this.
Thank you in advance. A high level solution or a detail solution on how to do this would be extremely helpful.
SharePoint has the ability to receive messages and documents via e-mail through functionality called Mail Enabled Libraries.
First, you have to configure incoming email, which is a bit of work. Once SharePoint is configured to receive email, you have to configure a list to receive email.
References:
http://davecoleman146.com/2010/10/20/how-to-setup-mail-enabled-document-libraries-in-sharepoint-2010-part-1/
http://technet.microsoft.com/en-us/library/cc287879(v=office.14).aspx
EDIT
The manual process to upload a document would have the following steps:
Check email
If the email is there, save email to local file
Upload file to SharePoint
If you want to automate this process, I recommend PowerShell as its powerful yet easy to use.
Learning PowerShell: http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx
Checking Email with PowerShell: How to check an exchange mailbox via powershell?
Saving an Email with PowerShell: http://social.technet.microsoft.com/Forums/scriptcenter/en-US/335a888b-bf85-4a36-a555-71cc84608960/download-email-content-text-from-exchange-ews-with-powershell?forum=ITCG
Uploading a file to SharePoint With PowerShell: http://social.technet.microsoft.com/wiki/contents/articles/19529.sharepoint-2010-upload-file-in-document-library-using-powershell.aspx