How can I change sender in an outlook mailitem? - powershell

I inherited a script that goes through a shared inbox and will do a replyAll on the message, change some things, and then save it to the drafts folder. It is using the outlook.application com object in powershell. One of the first things we do is to change the sender in Outlook to our own email address instead of the shared mailbox account.
In Outlook, if we use the pull down and select the correct account and then send it works. However, I want to do this in the script as we often forget to do it manually.
I have a powershell object and have successfully changed it to use my account to send from:
$mailitem = $message.replyAll()
$mailitem.sendUsingAccount = $myacct
However, when I send the message, the from address is still set to the shared account.
I've also tried adding
$mailitem.SentOnBehalfOfName = "foo#bar.com"
$mailitem.Sender = "foo#bar.com"
with the same issue.
I'm hoping y'all might have some ideas on how to make this work.
Edit: Looks like How to change sender name in Outlook ? is closely related to this ticket. Not sure it is a duplicate though. My question here is around the difference between what the pulldown does to set my account in the outlook client and what I'm trying to do in the powershell script. If it works in the outlook client it should work in the powershell script. If the problem is SentOnBehalfOfName attribute, why wouldn't I have permissions to change it? I'm changing it to my email address.

Related

PowerShell (?) Check office 365 mailbox and forward emails to another system by reset API

I would love to have guidance as to the right way to do it.
I have to forward emails from Office 365 mailbox to another system by reset API.
The format of email is something like that:
Subject: TELLA SERVICE
Body:
Computer: TELLA
ERROR: STOP WORKING
It is also necessary to change the format of the email to something like this:
hostname = body>computer
service = subject
Description = Body>Error
I understand that the easy way to do this is with PowerShell. is it true?
And the steps are:
Connect to O365 and check the mailbox
Check if there is new emails
converter it to json with this settings ( hostname=body>computer, service=subject, description= body>error)
send the json by rest api
I'm new to the world of PowerShell and working with APIs, and if there is a template that I can start working on it will be very helpful..
Thank you
Meni
Working with O365, I normally would use a mailbox rule to do the forwarding. I'm sure that it can be done with a PowerApp also. As much as I love doing everything in PowerShell, I don't think it's the easiest way to do that.

Change source e-mail notification address for Google Script

Thank you for your time! Need help with google-apps-script.
I created Google Script code for E-mail notifications. By default, the E-mail notifications are sent from my e-mail address. I need to change the E-mail sender address to a different one. So, I changed the ownership of the script, but nothing changed, the script still sends E-mails from my original account. Please, help.
changing ownership is not mandatory what you have to do is to run the script with the other account.
You create a script and probably a trigger and setup it from original account. To change email of sender to another account. Stop trigger and setup script from the other account.
The sender will now be the new account as it run the script.
Stéphane

Make new gmail email not be grabbed by pop3

This seems like a fairly obvious thing but I can't figure out how to do it and am hoping one of your geniuses can help me out!
We have a Gmail email account and then a ticket system that checks that account and sends an auto-reply to the sender saying that the email was received. This is checked via POP3 but can also be done via IMAP if necessary.
What I want is this: For certain messages, I'd like to file them immediately in Gmail and have them go to a special folder and have them NOT be checked by the ticket system. That's all.
I tried creating a filter in Gmail to move them, skip the inbox, mark as read, all of that. They still get picked up by the ticket system.
I thought POP3 only checked the INBOX on any server, so I expected that if I skipped the inbox then it would not be accessible. This doesn't seem to be the case.
Please let me know if there are any tricks I can do.
Thank you so much!
Ben
The problem that you are running into is that when connecting to GMail via POP3, you are actually accessing the "All Mails" folder and not the Inbox, so filtering the messages does not remove them from the list presented to your client via POP3.
Switching to IMAP should solve this problem, however, since you'd be able to open whatever folder you wanted.

Add e-mail account to outlook with powershell

Using powershell I know how to add an exchange mailbox to an existing account, but i can't, for the life of me, figure out how to add another e-mail account to outlook, so the user gets the "From" field selector. Any hints from the PowerShell gurus around here?
Background: We have quite a few small biz users who make use of roomboxes to have common adress books, and to send mail as "the company". For instance the info#exampel.com roombox has its full access permissions, send as permissions, and mailflow delivery options set to allow, say, 15 people in the office to reply to mail as this box.
Obviously it gets tiresome to coordinate with each user, grab their account with RDP and click-type-click in the extra account. Powershell prefered, but other automated solutions wellcome too.
Thank you :)

Detecting outlook 2007 client in email

Is it possible to detect the email client in an html message? Specifically outlook 2007
Update
My users have access to an online system that really has nothing to do with email, but in this system they can all communicate with themselves.
My app - takes messages from this system, and then sends it via an email instead.
Now I need a reply to function. Obviously its not a normal email address so...
I want a way to intercept this message, and send it via another channel.
I could write the outlook plug to check EVERY SINGLE out going email address, but this surely can't be the way we're expected to work with email.
It would be much easier to have a button in the email itself which can call an outlook function (custom) and then pass control to this function.
Uodate
Thanks guys for your answer, but there is a little more complexity. The online system contains fields, these fields need to be completed by the user before sending the reply. So I need some kind of form (yes with working check boxes, etc in there). This should all be in the email message.
Essentially what you'll need to do is set up an automated process that monitors a particular email address, and set that address as the reply-to in your outgoing email. When a message comes in, you can do whatever analysis you need to (examining the from, subject, etc.) and process the content however you see fit.
"Detect" using what? Javascript does not work in email. CSS stylesheets don't either - so no CSS hacks.
Have you tried to change the Reply-To header in the email to the direction that you want?
You have an example in C# & VB in: http://www.systemwebmail.com/faq/2.7.aspx