Welcome › Forums › General PowerShell Q&A › SendUsingAccount is not working in Powershell
This topic contains 1 reply, has 2 voices, and was last updated by
(Yes, I know both Send-MailMessage and Net.Mail.SmtpClient exist)
$Outlook = New-Object -ComObject Outlook.Application
foreach ($account in $Outlook.Application.Session.Accounts)
if ($account.UserName -eq "accountusername")
$Mail = $Outlook.CreateItem(0)
$Mail.To = "email@example.com"
$Mail.Subject = "a subject"
$Mail.HTMLBody = "i am message
Im trying to send email from another Exchange account on my Outlook but it is not working. It sends it from the default.
Below solution might work for you.
The topic ‘SendUsingAccount is not working in Powershell’ is closed to new replies.